Reputation: 3625
I am looking to hook a callback AFTER a textarea changes size using jquery mobile. As an example, I have the following:
$('#test-textarea').val(BigTextVar).css('height', 'auto').trigger('change');
When this is hit, I want to run a function to resize div's above and below to accommodate the new height.
I tried adding a function to .trigger('change') but it happens BEFORE resize and not after. The same for .on('resize').
Upvotes: 0
Views: 304
Reputation: 24738
What if you trigger the resize event and then handle it:
$(document).on("pagecreate","#page1", function(){
$('#test-textarea').on("resize", function(e){
alert("height = " + $(this).outerHeight());
});
$('#test-textarea').val(BigTextVar).css('height', 'auto').textinput( "refresh" ).resize();
});
If you have timing issues, you could use a setTimeout to delay the resize trigger.
Upvotes: 1