如何克服jQuery错误“未找到$错误"? [英] How do I get past the jQuery error "$ not found error"?

查看:71
本文介绍了如何克服jQuery错误“未找到$错误"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

主窗口

// some javascript
//some html
//here ajax-call to load all divs
//all divs hidden by default
//based on user choice(from select option), show selected group of divs
//click any shown div to call corresponding popup

弹出窗口

//edit contents of that div.
//on close i need
1. refresh main window to load all divs
2. select the previously selected user option(from select option)
3. show corresponding divs only
4. most important is i have to give the user the main page,
   where they clicked the div before(not the page starting always!)

我尝试过,但留下了"$ not found error".有任何想法吗..?建议?

I tried and i am left with " $ not found error ". any ideas..? suggestions?

这是主窗口

     <script type="text/javascript" src="jquerymin.js"></script>
        <script type="text/javascript">
        var visible_status=0;
        function selectFn(sno){
        if(sno==1){
                $('#id2').hide();
                $('#id1').show();
                visible_status=1;
        }else if(sno==2){
                $('#id2').show();
                $('#id1').show();
                visible_status=2;
        }
        }

        function popitup(url) {
            newwindow=window.open(url+'?parent_status='+visible_status,'name');
            if (window.focus) {newwindow.focus();}
                return false;
        }
        </script>
        <select name='optionw' 
        onchange="selectFn(this.options[this.selectedIndex].value);">
        <option value="">Select</option>
        <option value="1">Div1</option>
        <option value="2">All</option>
        </select>
        <div id='id1' style="display:none;">DIV1</div><!--by ajax i am loading-->
        <div id='id2' style="display:none;">DIV2</div><!--these divs-->
        <button onclick="popitup('popup.php');">popUp</button><br><!--and these-->

弹出窗口

<script type="text/javascript" src="jquerymin.js"></script>
    <script type="text/javascript">
    var parent_status='<? echo $_GET[parent_status];?>';

    function closePopup() {
        window.opener.history.go(0);
        //alert('going to call parent selectFn('+parent_status+')');
        window.opener.selectFn(parent_status);
        self.close();
    }
    </script>

...Here  editing a part of the main page content...
<input type=button value=close_popup onclick="closePopup();">

如果我在closePopup函数中删除了注释,它将按预期工作.使它在不加换行的情况下起作用的任何帮助.

推荐答案

我建议您未正确链接到jQuery库或链接顺序错误.您能否提供有关您所要询问的更多详细信息?您是要代码执行此操作,还是只是在询问未找到jQuery对象?

I would suggest that perhaps you're not linking to the jQuery library properly or have it linked in the wrong order. Could you provide more details as to what you're asking? Do you want the code to do this, or are you just asking about the jQuery object not being found?

这篇关于如何克服jQuery错误“未找到$错误"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆