jQuery Run function on selector -


i want run function based on eq() selector:

$('div.entry-content div.one_fifth').eq(0, function(){     $(this).css({background: 'url(../wp-content/themes/genesis/images/plant_hire.jpg) no-repeat center'});     $(this).on('hover',function(){      alert('test');     }); }); 

what wrong syntax since inside function not working

thanks

this select 0 index of selector, change css, , attach event handler hover.

$('div.entry-content div.one_fifth')     .eq(0)     .css({background: 'url(../wp-content/themes/genesis/images/plant_hire.jpg) no-repeat center'})     .on('hover',function(){         alert('test');     }); 

edit, cut , pasted op had, assumed there no syntax errors.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -