user903345
user903345

Reputation: 370

Uncaught TypeError: Object [object Object] has no method 'autocomplete' (maybe not a conflict issue)

I realize that this thread has many friends already on here and all over other sites, but all threads seem to end in "you have a conflict." If I do have a conflict, I'm not seeing it, and if it's there, it's probably due to Telerik and its RadGrid, RadToaster, RadYoyo, etc. that's on the page. But it could also be that I'm just missing something. If I delete the jQuery inclusions that are in the <head>, I get a "$ is not defined" error.

Here's the <head> contents, including the jQuery inclusions but excluding the Telerik <link> tags. Any help would be appreciated. I'm stumped.

HTML with control:

    <div id="search">
        <form method="get">
            <input name="ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder1$q" type="text" id="ContentPlaceHolder1_ContentPlaceHolder1_q" size="35" placeholder="Search..." />
        </form>
    </div>

Header:

<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-40617410-1']);
    _gaq.push(['_trackPageview']);

    (function () {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
</script>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<link rel="stylesheet" href="../Content/smoothness/jquery-ui-1.10.0.custom.min.css" /><link href="../Content/Site.css" rel="stylesheet" type="text/css" /><link href="Parts.css" rel="stylesheet" type="text/css" />


<script language="javascript" type="text/javascript" src="../Scripts/LiveHelp.js"></script>

<script type="text/javascript" src="/Scripts/gridHelpers.js"></script>




    <script type="text/javascript">
        // needs to be present for clearFilter()
        var radGrid;

        $(document).ready(function () {
            $('#ContentPlaceHolder1_ContentPlaceHolder1_q').bind('keypress', function (e) {
                var code = (e.keyCode ? e.keyCode : e.which);
                if (code == 13)
                    DoSearch($('#ContentPlaceHolder1_ContentPlaceHolder1_q').val());
            });

            //$('#orderHistoryButton').bind('click', function () {
            //    DoOrderHistory();
            //});

            $('#ContentPlaceHolder1_ContentPlaceHolder1_favoritesButton').bind('click', function () {
                DoFavorites();
            });

            //$('#mostPopularButton').bind('click', function () {
            //    DoMostPopular();
            //});

            $("#ContentPlaceHolder1_ContentPlaceHolder1_CategoryFilter").change(function () {
                DoCategoryFilter($(this).val());
                //DoCategoryFilter(cat_ddl.val());
            });

            $('#ContentPlaceHolder1_ContentPlaceHolder1_q').autocomplete({ source: ['Lid'] });
            radGrid = $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_RadGrid1");
        });

        function DoSearch(searchText) {
            $("#ContentPlaceHolder1_ContentPlaceHolder1_CategoryFilter").val('');
            $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("Search" + "|" + searchText);
        }

        //function DoOrderHistory() {
        //    $('#ContentPlaceHolder1_ContentPlaceHolder1_q').val('');
        //    $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("OrderHistory");
        //}

        function DoFavorites() {
            $('#ContentPlaceHolder1_ContentPlaceHolder1_q').val('');
            $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("Favorites");
        }

        //function DoMostPopular() {
        //    $('#ContentPlaceHolder1_ContentPlaceHolder1_q').val('');
        //    $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("MostPopular");
        //}

        function DoCategoryFilter(id) {
            $('#ContentPlaceHolder1_ContentPlaceHolder1_q').val('');
            $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("Filter|" + id);
        }

        function AddToCart(partId) {
            var quantity = $('#qty_' + partId).val();
            $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("AddToCart" + "|" + partId + "|" + quantity);
            var currentQuantity = parseInt($find("ContentPlaceHolder1_ContentPlaceHolder1_m_CartItemCountLabel").innerHTML);
            if (!isNaN(currentQuantity)) {
                currentQuantity += quantity;
                $find("ContentPlaceHolder1_ContentPlaceHolder1_m_CartItemCountLabel").innerHTML = currentQuantity;
            }
        }

        function refreshGrid(arg) {
            if (!arg) {
                $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("Rebind");
            }
            else {
                $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("RebindAndNavigate");
            }
        }

        function ShowDetailView(id) {
            window.radopen("DetailView.aspx?id=" + id, "DetailViewWindow");
            return false;
        }

        function ImagePreview(id) {

        }


    </script>


<style>body { background: transparent url('/images/background4.jpg') no-repeat top center; }</style>

<script type="text/javascript">
    $(document).ready(function () {

        $("td.menu > li").css("color", "red");
        $("li ul li").css("color", "blue")
        $("li ul li").hide();
        $("ul.menu li").hover(

        function () {
            $("ul li", this).show();
        }, function () {
            $("ul li", this).hide();
        }

        );

    });
</script>
<style type="text/css" media="screen">
    body {
        background-size: 100% auto;
    }

    .mymenu
    {    
        margin: 0;
        padding: 0;
    }

    .mymenu li
    {    
        width: 100px;
        margin: 0;
        padding: 0px;
        list-style: none;
        float: left;
    }

    .mymenu li a
    {    
        display: block;
        margin: 0 1px 0 0;
        padding: 4px 0px;
        width: 100px;
        /*background: #bbbaaa;*/
        color: #ffffff;
        text-align: center;
    }

    .mymenu ul a:hover
    {    
        background: #2f2f2f
    }

    .mymenu ul
    {    
        position: absolute;
        visibility: hidden;
        margin: 0 1px 0 0;
        padding: 0;
        /*background: #eeebdd;*/
        /*border: 1px solid #ffffff*/

    }

    .mymenu ul a
    {    
        position: relative;
        display: block;
        margin: 0 1px 0 -30px;
        padding: 5px 10px;
        width: 140px;
        text-align: left;
        background: #000000;
        color: #ffffff;
    }    
</style>
<script type="text/javascript">
    //variables' declaration
    var timer     = 0;
    var item      = 0;

    //function for opening of submenu elements
    function openelement(num)
    {    

        //checks whether there is an open submenu and makes it invisible 
        if(item) item.style.visibility = 'hidden';

        //shows the chosen submenu element
        item = document.getElementById(num);
        item.style.visibility = 'visible';
    }

    // function for closing of submenu elements
    function closeelement()
    {
        //closes the open submenu elements and loads the timer with 500ms
        timer = window.setTimeout("if(item) item.style.visibility = 'hidden';",500);
    }

    //function for keeping the submenu loaded after the end of the 500 ms timer
    function keepsubmenu()
    {
        window.clearTimeout(timer);
    }
    //hides the visualized menu after clicking outside of its area and expiring of the loaded timer
    document.onclick = closeelement; 

</script>

Upvotes: 1

Views: 1373

Answers (1)

user903345
user903345

Reputation: 370

Of course it's a conflict! The code had a Telerik jQuery inclusion in the RadScriptManager that I missed. I should be more observant when taking over code.

Upvotes: 1

Related Questions