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...
-
I'm working on an attendance audit screen which allows the user to single click to confirm the selection and double click to create a re...
-
You cannot achieve the fixed row and column with HTML + CSS. You need the Javascript as well. Below is the HTML, CSS and Javasript th...
No comments:
Post a Comment