Bug Tracker

Modify

Ticket #8151 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

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

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

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.

Change History

comment:1 Changed 3 years ago by rwaldron

  • Owner set to drew.repasky@…
  • Status changed from new to pending
  • Component changed from unfiled to attributes

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.

comment:2 Changed 3 years ago by rwaldron

  • Status changed from pending to closed
  • Resolution set to invalid

comment:3 Changed 3 years ago by jitter

  • Priority changed from undecided to low

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.