To get an set the value attribute of an html element, val()
method can be used.
<script>
alert($("#btnToggleClass").val());
</script>
Above code snippet will alert the value of the element whose id is “btnToggleClass” (in this case it is html button, it will return button text).
<script>
$("#btnToggleClass").val("New Value");
</script>
Above code snippet will set the specified value to the html element whose id s “btnToggleClass” (in this case, it will set the text of button to “New Value”).
Views: 5132 | Post Order: 38