Trigger the change event for the selected elements: - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:change

Description

Trigger the change event for the selected elements:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        $("input").change();
    });// w  w w  .  ja va 2s.com
});
</script>
</head>
<body>

<button>Trigger change event for input field</button>

<p>Enter your name: <input value="Mary" onchange="console.log(this.value)" type="text"></p>

</body>
</html>

Related Tutorials