Reputation: 5968
I'm having trouble doing a relatively simple task. I'm using jAlerts (http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/), which I'm aware is no longer supported, and trying to change the text of the buttons into a variable.
As of now, here is the beginning code of jAlerts, in which the buttons are defined as strings:
$.alerts = {
// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
repositionOnResize: true, // re-centers the dialog on window resize
overlayOpacity: .01, // transparency level of overlay
overlayColor: '#FFF', // base color of overlay
draggable: true, // make the dialogs draggable (requires UI Draggables plugin)
okButton: 'Ok', // text for the OK button
cancelButton: 'Cancel', // text for the Cancel button
deleteButton: 'Delete', // text for the remove button
dialogClass: null, // if specified, this class will be applied to all dialogs
What I'm trying to do is replace those with variables (in this case I'm using a large JS array):
$.alerts = {
// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
repositionOnResize: true, // re-centers the dialog on window resize
overlayOpacity: .01, // transparency level of overlay
overlayColor: '#FFF', // base color of overlay
draggable: true, // make the dialogs draggable (requires UI Draggables plugin)
okButton: property_dict['allDialog.OK.button.text'], // text for the OK button
cancelButton: property_dict['grid.Confirm.Delete.cancel'], // text for the Cancel button
deleteButton: property_dict['grid.Confirm.Delete.remove'], // text for the remove button
dialogClass: null, // if specified, this class will be applied to all dialogs
I see that at the top of the page, it says that these properties can be changed by accessing $.alerts.propertyName in your scripts -- the problem is, there seems to be no documentation anywhere on how to actually do this.
Can any jAlert ninjas out there help me out:?
Upvotes: 0
Views: 1732
Reputation: 46657
You do exactly what it said - "accessing $.alerts.propertyName in your scripts"
to change the text on the ok button:
$.alerts.okButton = 'string literal or variable here';
to change the text on the cancel button:
$.alerts.cancelButton = 'string literal or variable here';
Upvotes: 4