Let's say you have 3 buttons which starts with "f1" and below is the HTML tags:
<input type="button" id="f1.1" value="test1" />
<input type="button" id="f1.2" value="test2" />
<input type="button" id="f1.3" value="test3" />
When you run the following JQuery code, you will get different result:
var v1 = $('#f1.1'); => this returns zero match.
var v2 = $('input[id^="f1"]'); => this returns 3 matches.
var v3 = $('input[id="f1.2"]'); => this returns 1 match (i.e., the second button).
If you are using "#" in the selector, the result is either 0 or 1 (it's always stop after it found the first one).
For more details, check out the following reference:
http://api.jquery.com/category/selectors/
Subscribe to:
Post Comments (Atom)
We are moving
We are moving this blog to our new blog site: https://ciysys.com/blog/nodejs.htm
-
Overview Usually, we start developing a new system with designing database and then writing codes. If you are not a fan of ORM, you will h...
-
Below is the sample HTML which will hide the URL at the page header when printing with Javascript. <html moznomarginboxes > ...
-
You can draw a simple pie chart & doughnut chart with SVG + CSS. This is quite simple and straight forward. But the limitation is that i...
No comments:
Post a Comment