I have this block of HTML:
<snip>
<p>
        <label for="playerName">Player Name: </label>
        <input type="text" name="playerName-0" class="required spell"
minlength="2"/>
        <span class="spellResponse">
            <br/>&nbsp;Did you mean: <span
style="color:#295DAD;"><em><strong><span class="correctWord">Robert</
span></strong></em> Yes: <input type="radio" value="Y" class="spellQ"
name="spellQ"> No: <input type="radio" value="N" class="spellQ"
name="spellQ"></span><br/></span>
</p>
</snip>

I am using a click function on the input.spellQ that if value==Y it
grabs the text() from span.corretWord and places it in the previous
input.required.spell.

I am having trouble selecting the previous input.required spell.

Here is what I have for the funtion:

$('.spellQ').livequery('click',function() {
                        var qValue = $(this).val();
                        if(qValue == 'Y') {
                                var newText = $('span.correctWord').text();
                                var field = $('input.spell');
                                //This line below does not work :-(
                                $(this).prev(field).val(newText);
                                //console.log(newText);
                                //console.log(field);
                        }
                });

Thank you in advance for suggestions or assistance.

Reply via email to