Bug Tracker

Modify

Ticket #7443 (closed feature: invalid)

Opened 3 years ago

Last modified 2 years ago

Make .text()/.val() interchangable

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

Description (last modified by john) (diff)

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

comment:1 Changed 3 years ago by john

  • Owner set to john
  • Status changed from new to assigned
  • Component changed from unfiled to attributes

comment:2 Changed 3 years ago by john

  • Description modified (diff)

comment:3 Changed 3 years ago by rwaldron

  • Keywords needsdocs added
  • Priority changed from undecided to low

comment:4 Changed 3 years ago by dmethvin

See also #6827.

comment:5 Changed 3 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 3 years ago by dmethvin (previous) (diff)

comment:6 Changed 2 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 2 years ago by jitter

  • Status changed from assigned to pending
  • Version changed from 1.4.3 to 1.5
  • Milestone set to 1.next

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

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

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

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 2 years ago by dmethvin

  • Keywords needsdocs removed

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.