JQuery onclick function to focus input
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
function high(){
$("#in12").focus();
}
</script>
<style>
</style>
</head>
<body>
<input id="in12">
<p>Click on "check" button to get focus on input field "in11".</p>
<button id="b1" value="sdf" onclick="high();">check</button>
</body>
</html>
Output==>

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
function high(){
$("#in12").focus();
}
</script>
<style>
</style>
</head>
<body>
<input id="in12">
<p>Click on "check" button to get focus on input field "in11".</p>
<button id="b1" value="sdf" onclick="high();">check</button>
</body>
</html>
Output==>
Comments
Post a Comment