jQuery gets att...LOGIN

jQuery gets attribute information value

jQuery gets the attribute information value

$().attr(attribute name); //Get the attribute information 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(){
                alert($("#in").attr('value'));
            }
        </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(){ alert($("#in").attr('value')); } </script> </head> <body> <input type="text" value="你好" id="in"/> <input type="button" value="获取属性" onclick="get()"> </body> </html>
submitReset Code
ChapterCourseware