Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: jQuery JQueryUI
Hello!
After generated HTML element with attribute class =".item", my Event Hover does not work
 
$(".item").hover(
    function () {
      $(this).css('opacity','0.9');
    },
    function () {
 
      $(this).css('opacity','0');
 
    }
  );
 
How it fix?
Posted 27-Apr-13 6:47am
Comments
patel_vijay at 27-Apr-13 12:46pm
   
What is written in css for .item?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

checkout this working sample
 
http://jsfiddle.net/qryY3/[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
this function worked on my computer,i don't know your html structure.
try this
<style>
.item{
height:300px;
width:300px;
background-color:yellow
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
	$(function(){	
		$(".item").hover(function(){//if it doesn't work change the code like
			$(this).css('opacity','0.9');//$(".item").live('hover',function(){ and try again
		},function(){
			$(this).css('opacity','0');
		});
	})
</script>
<div id="div1" class="item">
</div>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 270
1 Sergey Alexandrovich Kryukov 185
2 BillWoodruff 173
3 CPallini 155
4 Kamal Rocks 144
0 OriginalGriff 5,655
1 DamithSL 4,506
2 Maciej Los 3,997
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 27 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100