Targeting the text in a radio button

I have this radio button:

<input class="price_show" checked="" type="radio" name="form[0][price_show]" value="1">yes

and I want to target the “yes” but I do not know what jquery method to use…this is the selector I have been using so far:

$('.price_show:checked').

but I do not know where to go from there…

I believe you need to surround it with <label> tags to be able to change “yes” to something else.

1 Like

I do not want to change it,I just want to “grab” it.

Yes, so if you put the proper label element around it, you’ll have something to grab. :slight_smile:

1 Like

 
…also bear in mind that the label element should be
considered essential rather than optional coding. :winky:

Further reading:-

Accessible Forms – Should Every Input Have a Label?

coothead

You can get the text with $('.price_show:checked')[0].nextSibling.nodeValue

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.