0

we are loading jquery scripts in our header tag of a sitemesh decorator JSP like this:

<head>
<script src="${prefix}/resources/js/jquery/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="${prefix}/resources/js/jquery/jquery-ui-1.8.20.custom.min.js" type="text/javascript"></script>
</head>

now i am creating a autocomplete combobox like the one @ http://jqueryui.com/resources/demos/autocomplete/combobox.html

on click of an tag i am loading another jsp into a dialog box like below:

$.ajax({
url: <some url>,
success: <create my dialog>
});

This JSP inside dialogue box also gets decorated by sitemesh and has the same scripts in tag of it. The dialogue works fine but now after this ajax call my combobox() stops working and on console the error is:

$().combobox is not a function..

This is an urgent defect for me. has someone come across this issue before ? is it related to jquery script caching or loading?

We could reproduce this issue both in firefox and IE 9.

  • 1
    Can you show your actual code, or maybe a demo at jsFiddle that shows your problem? – mgibsonbr Dec 19 '12 at 18:09
  • Are there any errors that you see? Javascript errors? – TJ- Dec 19 '12 at 18:10
  • The issue was that my javascript code for combobox was in local script and it was not reloaded with js files on ajax call. I moved the combobox component code to a common js which solved the issue. – Vivek Malhotra Dec 26 '12 at 09:23

1 Answers1

1

ComboBox is not a typical feature of jQueryUI. If you check the page source for the demonstration page you've provided, you'll notice that the widget is declared in a script tag starting on line 31:

    <script>
(function( $ ) {
    $.widget( "ui.combobox", { //... et cetera

Include the widget definition somewhere within your JS files as it appears in the combobox demo, and see if this resolves your issue.