Possible Duplicate:
jQuery 1.7 - Turning live() into on()
I have this code:
<script>
jQuery('#ultimecomunicazioni')
.live("mouseenter", function() {
jQuery(this).append('<span id="ultimecomunicazioni_appear" style="font-weight:normal;margin-left:5px">(<a style="color:grey" href="<?php echo esc_url( home_url( '/' ) ); ?>comunicazioni/">tutte</a>)</span>');
})
.live("mouseleave", function() {
jQuery(this).children('#ultimecomunicazioni_appear').remove();
});
</script>
I'd like to change the two .live to .on and combine the 2 handlers in one. I tried to use this example by TJ but I get confused from the 'tr' at the end.. it should be something like this but I'm not sure:
<script>
jQuery('#ultimecomunicazioni').on({
'mouseenter' : function () {
jQuery(this).append('<span id="ultimecomunicazioni_appear" style="font-weight:normal;margin-left:5px">(<a style="color:grey" href="<?php echo esc_url( home_url( '/' ) ); ?>comunicazioni/">tutte</a>)</span>');
},
'mouseleave' : function () {
jQuery(this).children('#ultimecomunicazioni_appear').remove();
}
});
</script>