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-


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.

Shaharia is a professional software engineer with more than 10 years of experience in the relevant fields. Digital ad certified, cloud platform architect, Big data enthusiasts, tech early adopters.

Site Footer