开发者

jquery input slector

开发者 https://www.devze.com 2023-02-18 06:46 出处:网络
开发者_运维百科want to access select list where id starts with sentidd $(\'.select[id^=sentidd]\').change(function() {}
开发者_运维百科

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

0

精彩评论

暂无评论...
验证码 换一张
取 消