0

I have 2 jquery script and 1 javascript which are conflicting with each other.

Below is code. Please let me know how to resolve this

1.) jquery for calender

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type="text/javascript">

function getCityDate(cityName,StarType)
{
    if(cityName && StarType)
    {
        // Call the php page to get the HTML
        $.ajax({
            url: 'ajaxSearchHotelDateSelect.php?cityName='+cityName+'&StarType='+StarType,
            success: function(responseHTML) {
                // Set the HTML somewhere on the page - note: if you are returning a full page of HTML you shouldn't include all the <html><body> tags etc...
                $("#homeMainTextDiv").html(responseHTML);
                // Now that your HTML is available in the DOM you can initiate the datepicker()
                $("#StartDate").datepicker({
                    numberOfMonths: 3,
                    minDate: "0", 
                    maxDate: "+1Y",
                    dateFormat : "dd-mm-yy",
                    /*

                    altFormat: "dd-mm-yy",
                    maxDate: "+3M +10D",
                    changeMonth: true,
                    changeYear: true,
                    showWeek: true,
                    firstDay: 1,

                    */
                    showOn: "button",
                    buttonImage: "images/calander_hotel_booking_final.png",
                    showAnim: "slideDown",
                    buttonImageOnly: true,
                    showButtonPanel: true
                });
            }
        });

    }//if(cityName && StarType)
}
</script>

2.) jquery for auto complete

<script type="text/javascript" src="jquery/ajax-autocomplete/jquery.js"></script>
<script type='text/javascript' src='jquery/ajax-autocomplete/jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="jquery/ajax-autocomplete/jquery.autocomplete.css" />

<script type="text/javascript">
$().ready(function() {
    $("#searchText").autocomplete("ajaxSearchAutoComplete.php", {
        width: 750,
        matchContains: true,
        mustMatch: true,
        minChars: 3,
        //multiple: true,
        //highlight: true,
        //multipleSeparator: ",",
        selectFirst: true
    });
});
</script>

3.) Javascript for pop window with blackout screen

<body onload="Popup.showModal('modal',null,null,{'screenColor':'#333333','screenOpacity':.5});return false;" >

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

<center>
    <div id="modal" style="border:0px solid #0066FF ; padding:5px; font-size:150%; text-align:center; display:none; width:300px; height:250px;">
        <a href="index.php" target="_self"></a><input type="image" src="images/close.png" width="30" height="30" alt="X" onClick="Popup.hide('modal')" style="cursor:pointer; float:right;">                            
        <div style="background:url(images/homeDateSelectionBg.png) no-repeat left top; width:292px; height:192px; margin-top:25px;">

        </div>
    </div>
</center>

If I remove auto comlete jquery and pop up javascript, calender fine work fine else not .

How to fix that? My calender is coming via ajax and in pop window.

4
  • 1
    you are loading jQuery twice... Commented Jun 13, 2013 at 21:06
  • 1
    And two different versions as well! Commented Jun 13, 2013 at 21:10
  • @AS just try using the first one and remove <script type="text/javascript" src="jquery/ajax-autocomplete/jquery.js"></script> Commented Jun 13, 2013 at 21:15
  • removed but still calender not working Commented Jun 13, 2013 at 21:24

1 Answer 1

1

I guess you have a js error which is not letting you to run your other js code. Replace

$().ready(function() {

with

$(document).ready(function() {
Sign up to request clarification or add additional context in comments.

4 Comments

The above is not working. Problem is that calender jquery stop working when we enable autocomplete jquery and pop js.
Uncaught TypeError: Object #<Object> has no method 'datepicker'
make sure you have included jQuery library only once in the page.
ya it is jquery version problem. I was calling 2 jquery. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.