最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

使用jQuery獲得內(nèi)容以及內(nèi)容的屬性

 更新時(shí)間:2015年02月26日 10:58:09   投稿:hebedich  
本文給大家分享的是一則使用jQuery獲得內(nèi)容以及內(nèi)容的屬性的方法和示例,非常實(shí)用,推薦給大家。

復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="js/jquery.js"></script>
    </head>
<style>
body{font-family: "微軟雅黑";width: 980px; margin: 0 auto; text-align: center;}
    .box{
        width: 300px;
        height: 300px;
        background: green;
        border: 1px solid #e6e6e6;
        line-height: 200px;
        position: absolute;
    }
button{
    border: none;
    background: green;   
    width: 125px;
    height: 50px;
    line-height: 50px;
    color: #fff;
    font-size: 16px;
    margin-top: 50px;
    font-family: "微軟雅黑";
    }
</style>
    <body>
        <button id="btn1">顯示text</button>
        <button id="btn2">顯示html</button>
        <button id="btn3">顯示輸入內(nèi)容</button>
        <p id="text">這是要顯示<b>粗體</b>的節(jié)奏</p>
        <br />
        <input id="input" value="買房子">
        <script>
            $(document).ready(function(){
                $("#btn1").click(function(){
                    alert("Text: " + $("#text").text());
                });
                $("#btn2").click(function(){
                    alert("HTML: " + $("#text").html());
                });
                $("#btn3").click(function(){
                    alert("Value: " +$("#input").val());
                });
            });
        </script>
    </body>
</html>

Tips:

1、點(diǎn)擊事件節(jié)點(diǎn)的選擇 #botton

2、alert 的代碼規(guī)則  ("Value: " + $("#id").html)

今天的分享就先到這里了,后續(xù)我們還將持續(xù)更新一些新的jQuery實(shí)例。

相關(guān)文章

最新評(píng)論

汉阴县| 凤庆县| 贵港市| 卓尼县| 五台县| 博客| 竹北市| 巍山| 永寿县| 治多县| 巍山| 镇宁| 竹北市| 华阴市| 汨罗市| 铁力市| 景谷| 万盛区| 青川县| 青浦区| 丰镇市| 宁晋县| 老河口市| 抚州市| 温州市| 霍城县| 南昌县| 柳河县| 平远县| 怀化市| 西乌| 邳州市| 德庆县| 大姚县| 灵寿县| 杨浦区| 鄂州市| 金川县| 木里| 昌平区| 甘南县|