I am setting a taxtbox value using jquery in document.ready().
On a button click, I am trying to access its value as txtbox1.Value() but I am getting “” empty string. But if I use an alert msg I get its value alert($(‘txtbox1’).val())
Please let me know whats the problem.
Thanks.
It looks to me that you may have confused two different ways to get the value of an element.
HTML
JS
The first option get the document reference using jQuery syntax
$("#txtbox1")then uses the jQuery function.val()to get the value of the input.The second option instead uses standard javascript to get a element reference via
document.getElementById("txtbox1")and grabs the value from that object with.value.EXAMPLE