Bug Tracker

Opened 11 years ago

Closed 10 years ago

#4160 closed bug (invalid)

Value Attribute (as meta-data) Only works with numbers

Reported by: ghostdx Owned by:
Priority: trivial Milestone: 1.3.2
Component: unfiled Version: 1.3.1
Keywords: value attribute Cc:
Blocked by: Blocking:

Description

I tried changing SELECT > OPTION into UL > LI and adding the value attribute of the options to the LI. It worked fine with numbers but when I tried to use strings it would return a -1. I changed the attribute name to "valuez" and it worked fine.

Change History (5)

comment:1 Changed 11 years ago by dz

Here's a sample test case:

http://jquery.nodnod.net/cases/121

The "valuez" attribute shows the correct value whilst the "value" attribute on the li is "0".

comment:2 in reply to:  1 Changed 11 years ago by ghostdx

Replying to dz:

Here's a sample test case:

http://jquery.nodnod.net/cases/121

The "valuez" attribute shows the correct value whilst the "value" attribute on the li is "0".

Thanks for the example! :) I think it does not work not only with UL > LI but with any HTML tag with the VALUE attribute.

comment:3 Changed 11 years ago by dmethvin

Sorry, I am not seeing the issue. It looks like the test case was edited. can you include a few short lines that demonstrate the problem? To put code in the post, use three { characters in a row with no spaces:

{{{
your code here
}}}

comment:4 Changed 11 years ago by dz

Try:

<script>
$(function(){alert($('<li value="test"></li>').attr('value'));});
</script>

comment:5 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

In HTML4 the value attribute of an li gives you the ordered list number:

http://www.w3schools.com/tags/att_li_value.asp

So the cause lies outside jQuery, you can see it from this example:

<li id="arf" value="dog"></li>
alert(document.getElementById("arf").value);
Note: See TracTickets for help on using tickets.