close

例:返回被選中元素的內容

$("元素").html() 

例:設定一個值,並覆蓋被選中元素的所有內容
$(元素).html(內容)

<script type="text/javascript">
$(document).ready(function(){
$(".btn1").click(function(){
$("p").html("Hello <b>world!</b>");
});
});
</script>

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button class="btn1">改變 p 元素的內容</button>

arrow
arrow
    全站熱搜

    stockwfj3 發表在 痞客邦 留言(0) 人氣()