jQuery - 在document.ready上隐藏一个span

P.B*_*key 0 jquery

我想在document.ready上隐藏一个span.我试过了

<script type="text/javascript">
    //Set the stuff we want to be able to use in javascript, but not display in the browser window invisible
    $(document).ready(
        function () {
            ('#_ctl0_ContentPlaceHolder1_lType').hide()
        });
</script>
Run Code Online (Sandbox Code Playgroud)

但是,我在IE7调试器中收到错误"对象不支持此属性或方法".我在源代码中验证了对象存在为a <span>并且id是正确的.

Nea*_*eal 7

试试这个:

    $(document).ready(function () {
        $('#_ctl0_ContentPlaceHolder1_lType').hide();
    });
Run Code Online (Sandbox Code Playgroud)

你离开了$.