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 BillWoodruff 360
1 Mathew Soji 309
2 Maciej Los 270
3 DamithSL 225
4 Afzaal Ahmad Zeeshan 202
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.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