[PHPLondon-discuss] JQuery .attr

Marcus Bointon marcus at synchromedia.co.uk
Sun Sep 23 00:20:40 BST 2007


On 22 Sep 2007, at 11:38, Alex V. wrote:

> let i have <input id=element name=name type=text value="" />
> if I do $('#element').attr('value') - it returns "undefined"

 From the jquery docs I can see that the recommended way of doing  
this is $('#element').val(). I don't know if that will give you  
anything different, but it does seem odd that it doesn't distinguish  
between undefined and an empty string.

You're missing quotes around your attribute values, but you probably  
knew that.

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Creators of http://www.smartmessages.net/
UK resellers of info at hand CRM solutions
marcus at synchromedia.co.uk | http://www.synchromedia.co.uk/





More information about the Phplondon-discuss mailing list