Opened 9 years ago
Closed 9 years ago
#15109 closed bug (notabug)
bug about Attribute Equals Selector [name="value"]
Reported by: | wxpxzdj | Owned by: | wxpxzdj |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.11.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Change History (5)
comment:1 Changed 9 years ago by
Owner: | set to wxpxzdj |
---|---|
Status: | new → pending |
comment:2 Changed 9 years ago by
Status: | pending → new |
---|
jquery 1.11.1
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="http://code.jquery.com/jquery-1.11.1.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#btn").click(function () { $("#number").text($("input[name='code'][value='1']").length); $("input[name='code'][value='1']").css("background", "#FF6633"); return false; }); }); </script> </head> <body> <form id="form1"> <div> <input type="text" name="code" value="1" /><br/> <input type="text" name="code" value="1" /><br/> <input type="text" name="code" value="" /><br/> <input type="text" name="code" value="" /><br/> <input type="button" value="find the 1" id="btn" /><br/> find:<label id="number"></label> </div> </form> </body> </html>
jquery 1.8.1
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="http://code.jquery.com/jquery-1.8.3.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#btn").click(function () { $("#number").text($("input[name='code'][value='1']").length); $("input[name='code'][value='1']").css("background", "#FF6633"); return false; }); }); </script> </head> <body> <form id="form1"> <div> <input type="text" name="code" value="1" /><br/> <input type="text" name="code" value="1" /><br/> <input type="text" name="code" value="" /><br/> <input type="text" name="code" value="" /><br/> <input type="button" value="find the 1" id="btn" /><br/> find:<label id="number"></label> </div> </form> </body> </html>
comment:3 Changed 9 years ago by
Status: | new → pending |
---|
No, you need to put this code into a fiddle on jsfiddle and post the link back here.
comment:4 Changed 9 years ago by
Status: | pending → new |
---|
http://jsfiddle.net/BqPs5/3/
(PS:I'm sorry......)
comment:5 Changed 9 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
This is working exactly as expected. [value='1']
selects elements with a "value" attribute equal to 1
, regardless of the current "value" property (e.g., as set by .val
or .prop
).
Note: See
TracTickets for help on using
tickets.
Please provide a test case using jsFiddle, as described on http://bugs.jquery.com