Skip to main content

Bug Tracker

Side navigation

#7443 closed feature (invalid)

Opened November 08, 2010 09:40PM UTC

Closed February 18, 2011 07:54AM UTC

Last modified May 20, 2011 07:14PM UTC

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

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/

Attachments (0)
Change History (9)

Changed November 08, 2010 09:41PM UTC by john comment:1

component: unfiledattributes
owner: → john
status: newassigned

Changed November 08, 2010 09:41PM UTC by john comment:2

description: 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. \ \ jQuery("#test1").text( "Hello" );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/

Changed November 08, 2010 10:15PM UTC by rwaldron comment:3

keywords: → needsdocs
priority: undecidedlow

Changed November 09, 2010 01:49PM UTC by dmethvin comment:4

See also #6827.

Changed November 09, 2010 01:55PM UTC by dmethvin comment:5

_comment0: 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.1289310945158279

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.

Changed February 03, 2011 10:00PM UTC by etiger13 comment:6

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

Changed February 04, 2011 01:12AM UTC by jitter comment:7

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?

Changed February 18, 2011 07:54AM UTC by trac-o-bot comment:8

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!

Changed May 20, 2011 07:14PM UTC by dmethvin comment:9

keywords: needsdocs