jQuery sets mul...LOGIN

jQuery sets multiple attribute information values

jQuery sets multiple attribute information values

##$().attr(json object); //Set information values ​​for multiple attributes at the same time. The key-value pair of the json object is the name and value

<!DOCTYPE html>
<html>
    <head>
        <title>php.cn</title>
        <meta charset="utf-8" />
        <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
        <script>
            function get(){
            var duo = {value:'设置了多个属性',type:'textarea'}
            $("#in").attr(duo);
            }
        </script>
    </head>
    <body>
        <input type="text" value="你好" id="in"/>
        <input type="button" value="设置属性" onclick="get()">
    </body>
</html>


Next Section

<!DOCTYPE html> <html> <head> <title>php.cn</title> <meta charset="utf-8" /> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script> function get(){ var duo = {value:'设置了多个属性',type:'textarea'} $("#in").attr(duo); } </script> </head> <body> <input type="text" value="你好" id="in"/> <input type="button" value="设置属性" onclick="get()"> </body> </html>
submitReset Code
ChapterCourseware