Bug Tracker

Opened 8 years ago

Closed 8 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:

Description

in jquery 1.11.1 http://v1.freep.cn/3tb_14052711285208qr512293.jpg http://v1.freep.cn/3tb_140527112855ndav512293.jpg in jquery 1.8.3 http://v2.freep.cn/3tb_140527112857nsen512293.png http://v2.freep.cn/3tb_140527112900v2g2512293.jpg

Change History (5)

comment:1 Changed 8 years ago by Rick Waldron

Owner: set to wxpxzdj
Status: newpending

Please provide a test case using jsFiddle, as described on http://bugs.jquery.com

comment:2 Changed 8 years ago by wxpxzdj

Status: pendingnew

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 8 years ago by Rick Waldron

Status: newpending

No, you need to put this code into a fiddle on jsfiddle and post the link back here.

comment:4 Changed 8 years ago by wxpxzdj

Status: pendingnew

http://jsfiddle.net/BqPs5/3/
(PS:I'm sorry......)

Last edited 8 years ago by wxpxzdj (previous) (diff)

comment:5 Changed 8 years ago by gibson042

Resolution: notabug
Status: newclosed

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).

http://jquery.com/upgrade-guide/1.9/#attr-versus-prop-

Note: See TracTickets for help on using tickets.