jQuery this and Selector $(this:first-child).css('color', 'red'); -


is possible use :selector following in jquery?

$('.galler_attr').bind('click', function() {    $(this:first-child).css('color', 'red');        }); 

no. you're trying mix function context string.

use this context of selector or call find() on $(this) search within dom scope of element. either

$('.galler_attr').bind('click', function() {    $(this).find(':first-child').css('color', 'red');  }); 

or (which resolves above internally):

$('.galler_attr').bind('click', function() {    $(':first-child', this).css('color', 'red');  }); 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -