I am working on a project that uses a speed template system, so the $ character is reserved and cannot be used in javascript variable names.
So I have to prefix jQuery variables and methods using jQuery, not $, for example. jQuery (document) .ready (function () {}); unlike $ (document) ready (function () {});
This is normal, but in this case I am using colorbox.
My code for calling colorbox works fine and looks like this:
jQuery(document).ready(function () { jQuery("#addUser").colorbox({ href:"add", width:"500px", onClosed: function (message) { dataTable.refresh(jQuery("#ajaxResult").text(message)); } }) ... })
I have a link inside colorbox to which I want to add the colorbox.close method, but when I click the link, I get this error:
Unprepared TypeError: unable to call close method undefined
This is my code:
jQuery(document).ready(function () { jQuery("a").click(function() { jQuery.colorbox.close("User added succesfully"); }); ... })
Can someone tell me why I can not close the colorbox?
By the way, the X that comes with colorbox still works to close it.
source share