Site icon Shaharia's Blog

Get value and read value of a DIV in jQuery

Sometimes it can make you questioned that to get value and to assign value of a DIV using jQuery can be performed by only one function and that is-

$("#ElementID").val()

With the same code as above we can assign value for this element in jquery..

$("#ElementID").val("The Value")

the difference is to give argument in jquery val() function or not.

But remember my last code will only assign value inside jquery operation. But text inside that element will not be changed.