javascript - hover() jquery only work on first item? -
my js this
$('#link').hover(function(){ $(this).find('.actionblck').css('opacity','0.85'); },function(){ $(this).find('.actionblck').css('opacity','1'); }); }); and have html <a id='link' href=".$link." target='_blank'> within foreach loop. work first item got effect, why? inspect html, has multiple link id.
ids meant unique. can have 1 element id on page. classes, though, can duplicated. classes meant provide clustering , grouping of common elements. ids menat select single element.
$('.link').hover(function(){ $(this).find('.actionblck').css('opacity','0.85'); },function(){ $(this).find('.actionblck').css('opacity','1'); }); }); with html <a class='link' href=".$link." target='_blank'> should work.
Comments
Post a Comment