开发者

get entire contents of a div

开发者 https://www.devze.com 2023-02-19 18:20 出处:网络
var thisWish = $(#div开发者_高级运维1).children(\'p,blockquote,.name\').html(); <div id=\"1\">
var thisWish = $(#div开发者_高级运维1).children('p,blockquote,.name').html();

<div id="1">
   <p>Hello</p>
   <blockquote> my name is </blockquote>
   <p class="name">Callum</p>
</div>

How can i put the entire contents of a div into a variable? I dont justwant the html of each variable, i need the elements aswell, so basically i need

thisWish = <p>Hello</p>
       <blockquote> my name is </blockquote>
       <p class="name">Callum</p>

Thanks


This should work:

thisWish = $('div#1').html()


try this...

 thisWish = $('div#1').html()
0

精彩评论

暂无评论...
验证码 换一张
取 消