How could I get the sub element by using an existed jQuery object ?
已经有了#divTest的对象,怎样通过它来得到其他的元素?
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div id="divTest">
<input type="text" value="a" />
<input id="next" type="text" value="b" />
<input type="text" value="c" />
<input type="text" title="d" value="d" />
<input type="checkbox" title="e" />
</div>
<script>
var myObj = $("#divTest");
//How could I get the checkbox element by using 'myObj'?
//解决办法:
var titlevalue = myObj.children("input[type='checkbox']").attr("title");
console.log(titlevalue);
</script>
</body>
</html>
子元素用 children 方法,后代元素用 find 方法