$element = $(element);
console.log($$("#" + element + " > p")[0]); // works
console.log($$($element + $$(" > p"))[0]); // something like this
我认为您需要"#" + element.id
尽管写$(element).select('p')
似乎更明智。
使用元素本身的select
方法:
$element.select('p')[0]
我对Prototype感到生疏,但我认为,如果您想查找所有<p>
元素,这些元素是您已经拥有的某些元素的直接子代,则可以这样做:
var firstPara = $(element).find(function(e) { return e.tagName.toUpperCase() === 'P'; });
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.