jquery input slector
want to access select list where id starts with sentidd
$('.select[id^=sentidd]').change(function() {}
It fails. Whats the correct syntax?
The following should do the trick:
$('select[id^="sentidd"]')
To play with jQuery selectors I recommend using the Interactive jQuery selector tester.
Try this - select[id^="sentidd"]
- notice the .
is gone and the new "
s.
You need to put the attribute value in quotes. You also have a .
before select. This means elements with the class select
not the HTML select
tag.
The selector should be:
$('select[id^="sentidd"]')
If your select has a class of select, what you provided will work.
If it doesn't, try:
$('select[id^="sentidd"]')
without a .
. .<something>
is the class selector. No dot means a tag selector. You can see what I provided in action here
精彩评论