Monday, December 3, 2012

How to get the data using onclick Event in java script ||Java script onclick event

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;


No comments: