Skip to main content

Bug Tracker

Side navigation

#4160 closed bug (invalid)

Opened February 16, 2009 05:49AM UTC

Closed May 10, 2009 04:32PM UTC

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.

Attachments (0)
Change History (5)

Changed February 16, 2009 07:12AM UTC by dz comment:1

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

Changed February 16, 2009 02:02PM UTC by ghostdx comment:2

Replying to [comment:1 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.

Changed February 17, 2009 12:23AM UTC by dmethvin comment:3

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

}}}

Changed February 17, 2009 12:35AM UTC by dz comment:4

Try:

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

Changed May 10, 2009 04:32PM UTC by dmethvin comment:5

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