I am attempting to insert a textarea into a JQuery dialog and I am getting hung up on the syntax of how the dialog I have to work with is set up (I didn’t write the dialog by the way, I just want to make changes to it). I have looked at some of the other questions that are similar to this on this site but they don’t seem to answer my question so I am hoping someone can shed some light on this for me.
Here is the code:
$('.rejection_toggle').button().click(function(event) {
var $dialog = $('<div />', {
text: Drupal.t('Are you sure you want to reject this form? If so, then please leave a comment as to why you are rejecting it.')
})
var $button = $(this);
$('body').append($dialog);
$dialog.dialog({
title: Drupal.t('Reject this form?'),
buttons: {
'Reject': function (event) {
var $submitID = $button.attr('id').replace('rejection-toggle', 'approval-buttons-reject'),
$submitButton = $('#' + $submitID);
$submitButton.click();
$dialog.dialog('close');
},
'Cancel': function (event) {
$dialog.dialog('close');
}
}
});
return false;
});
So how would I go about inserting a textarea before the buttons?
Thanks.
Ok I figured it out. I need to add:
After the var $dialog line.
Now I need to figure out how to get the input back into Drupal.