javascriptphpjqueryjqxwidgets

jqxWidget jqxwindow open script working only once


I have JS code for jqxWindow which works only one time:

$(document).ready(function () {
    $("#jqxwindow1 ").jqxWindow({ height: 800, width: 1212, maxWidth: 1600, maxHeight: 900, animationType: 'none', theme: 'fresh', autoOpen: false  });
    $("#jqxwindow2 ").jqxWindow({ height: 800, width: 1212, maxWidth: 1600, maxHeight: 900, animationType: 'none', theme: 'fresh', autoOpen: false  });
    $("#jqxwindow3 ").jqxWindow({ height: 800, width: 1212, maxWidth: 1600, maxHeight: 900, animationType: 'none', theme: 'fresh', autoOpen: false  });
    $("#jqxwindow4 ").jqxWindow({ height: 800, width: 1212, maxWidth: 1600, maxHeight: 900, animationType: 'none', theme: 'fresh', autoOpen: false  });
    $("#jqxwindow5 ").jqxWindow({ height: 800, width: 1212, maxWidth: 1600, maxHeight: 900, animationType: 'none', theme: 'fresh', autoOpen: false  });

$('div[id^="test"] p').click(function() {
    var string = "#jqxwindow" + $(this).text().split('|')[0];
    //alert("The window is opened : " + string);
    var opened = $(string).jqxWindow('isOpen');
    var action = 'close';
    if (opened == false)
        action = 'open';
        $(string).jqxWindow(action);
        $(string).jqxWindow('bringToFront');
    });
});

I was searching but every solution didn't work for me.

LE:

Uncaught TypeError: $(...).jqxWindow is not a function

on line

var opened = $(string).jqxWindow('isOpen');

Solution

  • I resolved: Just put before (document) jQuery and in function put argument $. ex. down:

             jQuery(document).ready(function ($) {
    //function code
        }
    

    And now it's work.