Saturday 16 July 2016

HTML Jquery – Text(InnerHTL) vs Value

In JQuery we have two functions called text and val which confuses most of the developers while we try to update an element(Div,Span,input,select)

The following are the breif usage of text and val
text[.text()] – This will return the inner html of an element. Text method is not supported in input elements. Mostly used with Div/Span
value[.val()] – It will return the value of the element. Its mostly used with input and select elements. Val cannot be used with DIV as value is not a supported property of DIV

If interested please go through the following JQuery article’s
http://api.jquery.com/val/
http://api.jquery.com/text/

No comments:

Post a Comment