[Solved] What is the difference in function between $(“#item”).val(); and document.getElementById(“item”).innerHTML;?


You can’t use val() if the element has no value. It’s equivalent to document.getElementById("item").value.

document.getElementById("item").innerHTML would be equivalent to $('#item').html().

http://api.jquery.com

solved What is the difference in function between $(“#item”).val(); and document.getElementById(“item”).innerHTML;?