jQuery .hover()和.click()不起作用

Mac*_*ret 1 html jquery click hover

我正在尝试添加一个简单的悬停和单击功能到我的页面的一部分,它不起作用.我已经完成了这一百次没有问题,但这次是不同的,我不知道为什么?

HTML:

<div class="description">
    <div id="wrapper">
        <p>bla bla bla</p>
        <div class="linkDesc">
            <a href="#">bla bla bla</a>
        </div>
        <div class="plusSign">&nbsp;</div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

jQuery的:

jQuery(document).ready(function () {

    $('#wrapper').hover(function () {
        $('this').addClass('hover');
    }, function () {
        $('this').removeClass('hover');
    });
    $('#wrapper').click(function(e) {
        e.preventDefault();
        var urlLocation = $('this').find('.linkDesc').children('a').attr('href');
        window.location = urlLocation;
    });
});
Run Code Online (Sandbox Code Playgroud)

Sus*_* -- 7

$('this')   // You have enclosed it as as a string
            // It will try to look for tagName called this
Run Code Online (Sandbox Code Playgroud)

应该

$(this)    // Removing the Quotes should work
Run Code Online (Sandbox Code Playgroud)

只有合法TagNames , classNames , psuedo Selectors and Id's的内容应该包含在行情中.

检查小提琴