Closed OsakaWebbie closed 9 years ago
Is there another event I should use to kick it into gear?
Triggering a change
event on the textarea, after load, should do the trick. Perhaps something like:
$(document).ready(function(){
$("#ctype").change(function(){ //insert template text in Contact description when applicable ContactType is selected
if (!$.trim($("#contactdesc").val())) {
$("#contactdesc").load("ajax_request.php",{'req':'ContactTemplate','ctid':$("#ctype").val()}, function() {
$(this).change();
});
}
});
});
Sorry I didn't respond sooner - I was buried deep in other fires to fight and didn't have a chance to do anything with my code. I just now tried it and it works - thanks.
So, there isn't an event that fires when AJAX fills a field? I would think that would cause problems for a lot of programmers.
Nifty little tool - thanks for putting it together in a jQuery sort of way after the initial alistapart version. I have one problem, though. I have a textarea that is sometimes filled with content in response to change in another field. In that case, it doesn't expand until some other action triggers the JS, like typing in the textarea. Here is my markup (a couple elements omitted for simplicity):
And my JS:
Is there another event I should use to kick it into gear? Or call something of yours after the load() call?