热门关键字:
jquery > jquery教程 > jquery教程 > 用text()方法设置内容

用text()方法设置内容

298
作者:管理员
发布时间:2021/1/28 14:27:03
评论数:0
转载请自觉注明原文:http://www.jq-school.com/Show.aspx?id=3561
下面的示例将向您展示如何设置段落的文本内容:


例试试这个代码»
<script>
$(document).ready(function(){
    // Set text contents of all paragraphs
    $(".btn-one").click(function(){
        $("p").text("This is demo text.");
    });
    
    // Set text contents of the first paragraph
    $(".btn-two").click(function(){
        $("p:first").text("This is another demo text.");
    });
});
</script>




如果您觉得本文的内容对您的学习有所帮助:支付鼓励



关键字:CSS
友荐云推荐