In this post i would like give an example on Javascript onclick event and How to get the data of text box using java script.In the below one i will write down a onclick event for button ,then get the text box data in it.Here we can a method GetValue which has been using to get the data of input control.
<input type="text" id="txtname"/>
<input type="submit" onclick="GetValue()" value="GetData"/>
//Java script
<script type="text/javascript">
function GetValue() {
var val=document.getElementById("txtname").value;
alert(val);
}
</script>
No comments:
Post a Comment