I have an ajax request which basically gets some HTML and puts it inside a <DIV>
tag.
However, if I then call something after this happens (like clicking a button) and try using div.append to that same DIV, I get the following error:
Uncaught Error: cannot call methods on resizable prior to initialization; attempted to call method 'option'
This is basically some snippets of my code:
if (formreq) {
$.ajax({
url: './json/admin/getHTML.php',
type: 'POST',
async: false,
data: { FORMSEQ : formreq } ,
dataType: 'json',
success: function(result)
{
var HTML = result["HTML"];
$('#blankform').append(HTML);
}
});
Then if I use something like:
$("#div_" + selectedItem).resizable('option', 'disabled',true);
Which the selector is a valid element on the HTML that was called via Ajax, I get the above error.
Any idea's? - Thanks
I have an ajax request which basically gets some HTML and puts it inside a <DIV>
tag.
However, if I then call something after this happens (like clicking a button) and try using div.append to that same DIV, I get the following error:
Uncaught Error: cannot call methods on resizable prior to initialization; attempted to call method 'option'
This is basically some snippets of my code:
if (formreq) {
$.ajax({
url: './json/admin/getHTML.php',
type: 'POST',
async: false,
data: { FORMSEQ : formreq } ,
dataType: 'json',
success: function(result)
{
var HTML = result["HTML"];
$('#blankform').append(HTML);
}
});
Then if I use something like:
$("#div_" + selectedItem).resizable('option', 'disabled',true);
Which the selector is a valid element on the HTML that was called via Ajax, I get the above error.
Any idea's? - Thanks
Share Improve this question asked Oct 18, 2013 at 13:42 realtekrealtek 8414 gold badges19 silver badges39 bronze badges 4- 1 When (and where) are you initializing the resizable widget? – Frédéric Hamidi Commented Oct 18, 2013 at 13:45
- Dynamically added elements are not automatically initialized in the currently used plugin. You will have to do it manually again. – Spokey Commented Oct 18, 2013 at 13:47
- Its being initialized after the Ajax request has been called, inside a .click event on another button 'outside' the #blankform DIV – realtek Commented Oct 18, 2013 at 13:47
-
You need to make sure you don't run the above
option
code before the user clicks on the button. – Barmar Commented Oct 18, 2013 at 13:52
1 Answer
Reset to default 5You need to initialize resizable with the disabled
option specified. It's in the documentation.
$( ".selector" ).resizable({ disabled: true });