I'd like to click a button in a dialog and change the text on the message area before running the function associated with the button or simply change the text as part of the function.
A:
You can use a .onclick event as such...
<div id="targetSelector">Click Me</div>
<div id="messageAreaSelector"></div>
//jquery code to attach click to targetSelector
$('#targetSelector').click(function() {
//code to update message area
$('#messageAreaSlector').html("Text to tell user");
//call to function you want to perform
CallSelfDefinedFunction(arguments);
});
Chris
2010-07-26 16:43:12
Perhaps I didn't make it clear enough that we're talking about a JQuery UI dialog structure. Once it is initialized, I should be able to ID the message area on the dialog as you suggest. From looking at the HTML through the EI's developer tools, the message area appears to have the same ID as the Div used implement the Dialog structure. Changing that element's html does not change the text in the dialog's message area.
RobGMiller
2010-07-26 19:29:56
A:
You can bind a function to the close event - http://jqueryui.com/demos/dialog/#event-close. I'm betting you can change your text in there.
awshepard
2010-07-26 16:43:14
The event.close is too late. The functions associated with the button as defined in the buttons option runs completely before the dialog closes because the button function is defined that way as in: buttons['View'] = function() { FunctionName(); $(this).dialog('close'); };
RobGMiller
2010-07-26 19:32:59
I should add that I need the user to see the text as the function runs before the dialog closes.
RobGMiller
2010-07-26 19:34:39
The following seems to work but not at the same time as a function associated with the Dialog button. $("#DialogIdentifyer p").text('Change Message area');If the statement runs as a single statement defined as the button function or within a single function defined as the button function, the Dialog text area will change. If the statement is called before the function that is supposed to be activated by the button, it does not work.
RobGMiller
2010-07-26 20:39:21