开发者

find a element with certain name in a js variable filled by a jquery query

I can search the dom with .find('.dbfieldname') to find all elements from the class dbname. I also can save the result as an object in a variable like that: myelems = .find(...

But 开发者_运维百科I can't search in my object for certain elements using find(). I tried the following:

my.find(*[name=versionnumber])

How can I do that right ?


Your logic is fine, my is already a jQuery object, so my.find() would normally work.

The problem is that .find() searches for childrens. What you want is my.filter('[name="' +versionnumber+ '"]');


jQuery(my).find("*[name=versionnumber]")

Btw, better use jQuery.find() or $.find() rather than just .find(), it makes code at least more readable.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜