Jquery Selector To Use To Match Id Starting With Any Matches
- Forums
- Javascipt
- Jquery Selector To Use To Match Id Starting With Any Matches
this post will show you how to use jquery selector to use to match id starting with any matches [8717], Last Updated: Tue Feb 07, 2023
jquery_audit
Wed Dec 31, 1969
0 Comments
116 Visits
if you have a div and want to match anything starting with whatever, you can use it like this:
$('[id^="wallpaper"]').live("click", function(){
as you can see, anything that has an id starting with wallpaper will invoke this function: for example:
<div id="wallpaperama">OK</div>
<div id="wallpaperamas">OK</div>
<div id="wallpapeforyou">FAIL</div>
for more info go to:
http://api.jquery.com/attribute-starts-with-selector/