Unable to use "this + ' div.someclass'" in jquery -
why working:
$('.btn').on('click', function(e) { e.preventdefault(); $('.btn div.custom').html('<i class="check"></i>'); });
but not? :
$('.btn').on('click', function(e) { e.preventdefault(); $(this + ' div.custom').html('<i class="check"></i>'); });
how can combine additional selectors? how accomplish in jquery?
use .find()
select descendant elements
$('.btn').on('click', function(e) { e.preventdefault(); $(this).find('div.custom').html('<i class="check"></i>'); });
or use context,
$('.btn').on('click', function(e) { e.preventdefault(); $('div.custom',this).html('<i class="check"></i>'); });
Comments
Post a Comment