国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

jQuery form event change() event

change event (change event)

Definition and usage

The change event occurs when the value of an element changes.

This event only applies to text fields, textarea and select elements.

change() function triggers a change event, or specifies a function to run when a change event occurs.

Note: When used with select elements, the change event occurs when an option is selected. When used with a text field or text area, this event occurs when the element loses focus.

Let’s write an example below

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
    <select>
        <option>安徽</option>
        <option>上海</option>
        <option>北京</option>
    </select>

    <p>php 中文網(wǎng)</p>
    
    <script>
        $('select').change(function(){
            $('p').css('color','red');
        })
    </script>
</body>
</html>

When the value in the drop-down option box changes, the color of the text in the p tag will change

Continuing Learning
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script> </head> <body> <select> <option>安徽</option> <option>上海</option> <option>北京</option> </select> <p>php 中文網(wǎng)</p> <script> $('select').change(function(){ $('p').css('color','red'); }) </script> </body> </html>
submitReset Code