欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery獲取標(biāo)簽文本內(nèi)容和html內(nèi)容的方法

 更新時(shí)間:2015年03月27日 09:19:29   作者:上大王  
這篇文章主要介紹了jQuery獲取標(biāo)簽文本內(nèi)容和html內(nèi)容的方法,實(shí)例分析了jQuery中text和html方法的使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了jQuery獲取標(biāo)簽文本內(nèi)容和html內(nèi)容的方法。分享給大家供大家參考。具體分析如下:

jQuery可以通過(guò)text和html方法獲取指定標(biāo)簽的文本內(nèi)容或者h(yuǎn)tml內(nèi)容

<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js">
</script>
<script>
$(document).ready(function(){
 $("#btn1").click(function(){
  alert("Text: " + $("#test").text());
 });
 $("#btn2").click(function(){
  alert("HTML: " + $("#test").html());
 });
});
</script>
</head>
<body>
<p id="test">This is some <b>bold</b> text in a paragraph.</p>
<button id="btn1">Show Text</button>
<button id="btn2">Show HTML</button>
</body>
</html>

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論