Skip to main content

Bug Tracker

Side navigation

#5013 closed enhancement (fixed)

Opened August 04, 2009 04:09PM UTC

Closed August 08, 2009 03:37AM UTC

Enhancement: val(callback)

Reported by: pmcelhaney Owned by:
Priority: minor Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc: pmcelhaney@gmail.com
Blocked by: Blocking:
Description

I was inspired by this question on Stack Overflow: http://stackoverflow.com/questions/1224133/1224191.

Modifying a val() on a form element feels a bit kludgy. If val took a function as an argument (which gets the original value and returns the new one), we could do things like this:

From the SO question

$('#abc').val(function(v) { return v + "test"; });

More realistic example

var formatPhoneNumber = function (input) { ... };

...

$('.phone').val(formatPhoneNumber);

}

Attachments (0)
Change History (1)

Changed August 08, 2009 03:37AM UTC by dmethvin comment:1

resolution: → fixed
status: newclosed

This is in the nightlies already and should be in 1.3.3.