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

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

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -