- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Jquery selectors help!
<select id="variant"></select>
<div>123</div>
<div id="options">
<img>
</div>
I need to use jquery to select the <select>
tag with the id of “variant” when a user clicks on the<img />
tag. somebody please help me.
I need to use jquery to select the tag with the id of “variant” when a user clicks on the tag. somebody please help me.
Which <img>
tag? any img tag?
the <img>
tag that is inside <div id="options">
the
<img>
tag that is inside<div id="options">
well, to explain why I am asking:
$('img')
will select that <img>
tag. However, it will also select any other image that might be on the page.
$('#options img')
will select it also, but would also select any other image (if any) that might be inside that div. So, you just need to figure out exactly how you’re going to identify the image you want. I would think that this selector (the second one I mentioned) is probably what you want, but I can’t answer that for sure.
However, as @crocodillon says, if all you need to do is move the focus to the <select>
input, use a label.
yes thanks what @crocodillon suggested worked for me thanks.