Forum Moderators: open
var myForm = $('#theformid');
var draftStatus = $(myForm).find('#draft');
var finalStatus = $(myForm).find('#final');
var theButton = $(myForm).find('#save');
$(draftStatus).on('click', function(){if($(theButton).val()!='Save'){$(theButton).val('Save')};});
$(finalStatus).on('click', function(){if($(theButton).val()!='Publish'){$(theButton).val('Publish')};});
function setButtonValue() {
$(this.form).find('#save').val(this.id === "draft"? 'Save': 'Publish');
}
$('#theformid').find('#draft').on('click', setButtonValue).end().find('#final').on('click', setButtonValue);
function setButtonValue() {
$(this.form).find('#save').val(this.id === "draft"? 'Save': 'Publish');
}
$('#theformid').find('input[name="radioname"]').on('click', setButtonValue);