<input id="email" name="email" type="text" value="[email protected]">
How do I get value of id=email and print it out to my console or anywhere for testing purposes ?
I tried, but no luck :(
script type="text/javascript">
document.getElementById('email').innerText;
</script>
There are two types of elements
.innerHTML
or .html()
in jquery like div's span's etc.value
or .val()
in jquery, like input types etcall you need o do is
console.log($('#email').val()) //jquery
or
console.log(document.getElementById('email').value); // javascript
try
console.log($('#email').val());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With