i want to select a group div for example:
<div><span>stackoverflow</span></div>
how can i do to out all this in a variable tmp
, and the output of tmp
, should be something like : console.log(tmp) // <div><span>stackoverflow</span></div>
how i can do tht with Jquery
Like the below:
<div><span>stackoverflow</span></div>
JS:
var tmp = $("div")[0];
//Or tmp = $("div").get(0);
console.log ( tmp );
var tmp = $('div > span').parent(); // 拿到div内部是span的所有div <br><br>
console.log(tmp); // 打印输出
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.