Skip to main content

Bug Tracker

Side navigation

#8151 closed bug (invalid)

Opened February 02, 2011 09:58PM UTC

Closed February 02, 2011 10:08PM UTC

Last modified February 03, 2011 09:49AM UTC

Assignment using val() behaves differently for textfields than it does for hidden textfields.

Reported by: drew.repasky@gmail.com Owned by: drew.repasky@gmail.com
Priority: low Milestone: 1.next
Component: attributes Version: 1.5
Keywords: Cc:
Blocked by: Blocking:
Description

Show the original value of a text box

document.getElementById("firstName").value

sample output: ''"Jimmy"''

Here's where I see inconsistent behavior. Changing the field using .val() shouldn't modify the original value -- regular text boxes work as expected but hidden fields do not.

$("#firstName").val("Drew")
document.getElementById("firstName").defaultValue

If #firstName is <input type="text"/> then this returns ''"Jimmy"'' which is correct.

If #firstName is <input type="hidden"/> then this returns ''"Drew"'' which is incorrect.

Attachments (0)
Change History (3)

Changed February 02, 2011 10:00PM UTC by rwaldron comment:1

component: unfiledattributes
owner: → drew.repasky@gmail.com
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists.

Changed February 02, 2011 10:08PM UTC by rwaldron comment:2

resolution: → invalid
status: pendingclosed

Changed February 03, 2011 09:49AM UTC by jitter comment:3

priority: undecidedlow