Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#7443 closed feature (invalid)

Make .text()/.val() interchangable

Reported by: john Owned by: john
Priority: low Milestone: 1.next
Component: attributes Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by john)

Right now there is a lot of confusion over when to use .text() or .val(). We could simplify it by making it such that .text() will set the value of input elements and textareas. No reason not to.

http://jsfiddle.net/wt9tu/

Change History (9)

comment:1 Changed 9 years ago by john

Component: unfiledattributes
Owner: set to john
Status: newassigned

comment:2 Changed 9 years ago by john

Description: modified (diff)

comment:3 Changed 9 years ago by Rick Waldron

Keywords: needsdocs added
Priority: undecidedlow

comment:4 Changed 9 years ago by dmethvin

See also #6827.

comment:5 Changed 9 years ago by dmethvin

Also, consider the XML/XHTML case in the code; this magic is only intended for HTML DOM documents that have a documented value property, right? And there's #6478 that will break the proposed .text() method.

Last edited 9 years ago by dmethvin (previous) (diff)

comment:6 Changed 9 years ago by etiger13

A reason not to would be that it promotes using .text() to set the value of an input. Users could start thinking that it sets the value for everything, including <option>s, which is not the case. .text sets the text of an element and .val sets the value. Simple to understand. Just because we can promote bad coding standards doesnt mean its the right thing to do

comment:7 Changed 9 years ago by jitter

Milestone: 1.next
Status: assignedpending
Version: 1.4.31.5

I also think there is no real need to do this, do we still want to do this? John?

comment:8 Changed 9 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:9 Changed 8 years ago by dmethvin

Keywords: needsdocs removed
Note: See TracTickets for help on using tickets.