Difference between val() and text() and html() in Jquery
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
You must login to ask question.
text()
– Sets or returns the text content of selected elementshtml()
– Sets or returns the content of selected elements (including HTML markup)val()
– Sets or returns the value of form fields<input type="text" id="values"> <script>
alert($("#values").val());
</script>
<div id="dv1">jquery</div> <script>
alert($("#dv1").text());
</script>