Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!
After generated HTML element with attribute class =".item", my Event Hover does not work

C#
$(".item").hover(
    function () {
      $(this).css('opacity','0.9');
    },
    function () {

      $(this).css('opacity','0');

    }
  );


How it fix?
Posted
Comments
vijay__p 27-Apr-13 12:46pm    
What is written in css for .item?

checkout this working sample

http://jsfiddle.net/qryY3/[^]
 
Share this answer
 
Hi,
this function worked on my computer,i don't know your html structure.
try this
CSS
<style>
.item{
height:300px;
width:300px;
background-color:yellow
}
</style>

JavaScript
<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>
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900