Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#6835 closed bug (wontfix)

.val() returns text on button elements with <= IE7

Reported by: septemberbrain Owned by:
Priority: undecided Milestone: 1.4.2
Component: attributes Version: 1.4.2
Keywords: value of button with different browsers Cc:
Blocked by: Blocking:

Description (last modified by dmethvin)

<script type="text/javascript"> $(document).ready(function(){


alert ($(this).attr('value')); alert ($(this).val());




<button id="AUT" value="AUT">Automotive</button> <button id="CON" value="CON">Consumer</button> <button id="ENT" value="ENT">Enabling Technologies</button> <button id="IND" value="IND">Industrial</button> <button id="NET" value="NET">Networking</button>

This script gives different values depending on whether you are using IE or another browser. Not sure if this is a bug or not but I thought someone should know.


Attachments (1)

test-6835.html (695 bytes) - added by dmethvin 13 years ago.
Test case

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by dmethvin

Attachment: test-6835.html added

Test case

comment:1 Changed 13 years ago by dmethvin

Description: modified (diff)

I've attached a test case that works properly with IE8 and shows the difference between .value, .val(), and .attr("value"); I don't have IE6/7 handy right now but if someone can run the test case and attach output it might help.

comment:2 Changed 13 years ago by dmethvin

OK, I got to an IE6 system and the test case indeed returns the innerText for *all* cases there. I also changed it to check this.getAttribute("value") and that is wrong as well. So I don't even see a way for jQuery to get the actual value property/attribute. See the community discussion here (near the bottom of the page):


I'll leave the ticket open for now, but this looks like it will be a wontfix unless someone has a good solution.

comment:3 Changed 13 years ago by addyosmani

Priority: undecided
Resolution: wontfix
Status: newclosed

As a more suitable solution (aside from improved documentation on the original issue) has not been proposed in the months since the original ticket was submitted, I agree with the original call by dmethvin to set this ticket to wontfix for now.

Please feel free to re-open if a working solution is found.

comment:4 Changed 13 years ago by jitter

It seems I found a way to get at the really value of the value attribute (at least in IE6 can't test other IE versions at the moment).

By using the DOM Level 1 getAttributeNode function.


live test case

Hope this still gets noted as I can't reopen the ticket

Last edited 13 years ago by jitter (previous) (diff)
Note: See TracTickets for help on using tickets.