I am using dialog box, which I am closing when a user click anywhere on page expect that dialog box.
Here is my code:
$('body').on('click','.ui-widget-overlay',function() { $('#myRateSettingsPopup').dialog('close'); });
Somehow its returning an error:
$(...).on is not a function
What is wrong with my code ?
I am using jquery-1.6.1.min.js , but I cannot update it to the latest version. I am bound.
Is there any other way to do this ?
The TypeError: "x" is not a function can be fixed using the following suggestions: Paying attention to detail in code and minimizing typos. Importing the correct and relevant script libraries used in code. Making sure the called property of an object is actually a function.
This is a standard JavaScript error when trying to call a function before it is defined. This error occurs if you try to execute a function that is not initialized or is not initialized correctly. This means that the expression did not return a function object.
You may experience the “jQuery is not defined error” when jQuery is included but not loaded. Make sure that it's loaded by finding the script source and pasting the URL in a new browser or tab. The snippet of text you should look for to find the URL to test.
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value is not actually a function.
Method on was introduced in jQuery version 1.7.
I think you have to upgrade your jQuery library to the newest version.
Otherwise, you can use bind:
$( ".ui-widget-overlay" ).bind( "click", function(e) { $('#myRateSettingsPopup').dialog('close'); e.stopPropagation(); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With