jquery hover().addClass() problem

后端 未结 4 729
南笙
南笙 2021-01-07 04:31

http://jsfiddle.net/aBaw6/2/

This demo does not add class when you hover a list item.

What am I doing wrong here?

$(\"li\").hover(
  function         


        
4条回答
  •  失恋的感觉
    2021-01-07 05:00

    Your javascript syntax is incorrect

    $(this).addClass('hover);
    

    Should be:

    $(this).addClass('hover');
    

    You forgot to terminate the string.

    It works just fine with this change.

提交回复
热议问题