开发者

How do you split a JQuery command up

$('#something :input')

if I 开发者_如何转开发already have something as an object, ie:

var x = document.getElementById('something');

How do I do :input on that?

Something like this perhaps?

$(x).(':input')


The equivalent of

$('#something :input')

is

$('#something').find(':input')

Note the space between the two selectors means that :input is a descendant of #something. This means the answer to your problem is

$(x).find(':input')

// Or, using selector context (which is less efficient but less chars)
$(':input', x)

http://api.jquery.com/find/


This should do the trick:

$(':input', x)

It searches for all :inputs that are descendants of x (using x as its context).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜