jQuery selector help - how to find element whose ID starts and ends with specific characters
- 阅读更多 关于 jQuery selector help - how to find element whose ID starts and ends with specific characters
问题 I have a page that's created dynamically. It can have a number of different radio buttons with ID's like so: <input type="radio" id="cc-radio-opt-0" /> <input type="radio" id="cc-radio-opt-1" /> <input type="radio" id="gc-radio-opt-0" /> <input type="radio" id="gc-radio-opt-1" /> In order to write change functions, I'm doing something like this: $('[id^=cc-radio-opt-]').live("change", function() { var idx = $(this).attr('id').split('-').pop(); }); This works well. But now, inside that change