Run a JQuery script only on childs of one element -


is there easy way of running jquery script on 1 specific form , it's children without effecting other forms on website.

at moment use child selector other selector, there command following selectors match within children of form?

thanks

you can use find:

$('#myform').find('.otherclass').css({color: 'red'}) 

the selector .otherclass searched inside #myform.

and small refactoring:

var $f = function(selector) { return $('#myform').find(selector); } 

you can use:

$f('.otherclass').css({color: 'red'}) 

to scoped version of jquery function.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -