How To Get Field Id Value With Javascript By Id Name

Forums » Javascipt » How To Get Field Id Value With Javascript By Id Name
if you want to learn how to get field id value with javascript i wills show you today on this page
if you want to learn how to get field id value with javascript i wills show you today, if you followed my tutorial before http://www.wallpaperama.com/forums/how-to-get-value-from-a-form-field-with-javascript-t7009.html

ok, well, if you want to get the value by id then its easy here is the javascript code that makes it all happen:

getElementById()



so here is the code you can use as an example i made for you. just copy and save it as javascript.html and then open it with your browser

<script type="text/javascript" charset="iso-8859-1">
function validate_form2(form) {
var user_name = document.getElementById('user_name').value;
window.alert('Hi '+user_name);
}

</script>
Enter your name and then hit submit
<form action="" method="post" onsubmit="return validate_form2(this);">
<input name="form[]" id="user_name" type="text" value="">
<input type="submit" value="Submit">
</form>





DEMO

Enter your name and then hit submit
siva
i know how to get the value thorught id but i want how to get id on java script
sree
testst for code something to be very shorttt
Title: How To Get Field Id Value With Javascript By Id Name [813]
Tags: javascript field form html code
By
Comments 3
Visits 14445