In this tutorial learn how to pass multiple values from html to javascript using id with blur event.
Pass multiple value from html to javascript by id with blur event, pass value from html to javascript and get value in function with javascript with display in a alert box.
Create a Html file and add input type then create a javascript function and create a two variable to get value by id
like function passvalue(idname1, idname2) {}
Example Index.html
please watch video how it works also
Pass multiple value from html to javascript by id with blur event, pass value from html to javascript and get value in function with javascript with display in a alert box.
Create a Html file and add input type then create a javascript function and create a two variable to get value by id
like function passvalue(idname1, idname2) {}
Example Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pass value to javascript</title>
</head>
<body style="text-align:center">
<h1> Pass Multiple Value to Javascript using by id</h1>
<!-- here we add method so i added onblue means leave pointer
create a two text box or input box
method onblue or event
onblur for pass value when leave text box
-->
<input type="text" name="fname" id="fname" placeholder="Name" /> <br> <br>
<input type="email" name="email" id="email" onblur="passvalue();" placeholder="Email" /> <br> <br>
<input type="email" name="value" /> <br> <br>
</body>
</html>
<script type="text/javascript">
<!-- get value using var variable display in alert -->
function passvalue(){
var fnameField=document.getElementById('fname').value;
var emailField=document.getElementById('email').value;
alert(fnameField + emailField) ;
}
</script>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pass value to javascript</title>
</head>
<body style="text-align:center">
<h1> Pass Multiple Value to Javascript using by id</h1>
<!-- here we add method so i added onblue means leave pointer
create a two text box or input box
method onblue or event
onblur for pass value when leave text box
-->
<input type="text" name="fname" id="fname" placeholder="Name" /> <br> <br>
<input type="email" name="email" id="email" onblur="passvalue();" placeholder="Email" /> <br> <br>
<input type="email" name="value" /> <br> <br>
</body>
</html>
<script type="text/javascript">
<!-- get value using var variable display in alert -->
function passvalue(){
var fnameField=document.getElementById('fname').value;
var emailField=document.getElementById('email').value;
alert(fnameField + emailField) ;
}
</script>
please watch video how it works also
No comments:
Post a Comment