下面的示例将向您展示如何设置段落的文本内容:
例试试这个代码»
<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>
如果您觉得本文的内容对您的学习有所帮助:
关键字:
jquery