pass value and get value in jquery using a Id and button, using the click method get the value of ids and pass value to input box or result in html
please download latest version of jquery
in html input type and button added
click event using button in script
Example Index.php
<!DOCTYPE html>
please watch video for more details also
please download latest version of jquery
in html input type and button added
Name:
<input type="text" name="val" id="Ids" value="" /> <br><br><br>
<!-- click button pass button -->
<button>submit</button> <br><br><br><br>
click event using button in script
$(document).ready(function(){
$("button").click(function(){
var mes=document.getElementById("Ids").value;
<!--show in alert box -->
alert(mes);
<!-- add in input text in result -->
document.getElementById("result").value=mes;
});
});
Example Index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- include jquery require these two file -->
<script src="jquery-3.1.0.js"></script>
<script src="jquery.min.js"></script>
<script>
<!-- pass value and get using jquery -->
$(document).ready(function(){
$("button").click(function(){
var mes=document.getElementById("Ids").value;
<!--show in alert box -->
alert(mes);
<!-- add in input text in result -->
document.getElementById("result").value=mes;
});
});
</script>
</head>
<body style="text-align:center">
<h1>pass and get value jquery tutorial 2</h1>
Name:
<input type="text" name="val" id="Ids" value="" /> <br><br><br>
<!-- click button pass button -->
<button>submit</button> <br><br><br><br>
Result:
<input type="text" name="result" id="result" value="" />
</body>
</html>
please watch video for more details also
No comments:
Post a Comment