I'm using a modal, the thing is that I want to change the value of an input field based on it. If modal is open value is "Update" when the modal is not displayed, the value is "create".
I tried like this but since it is executed only one time on page load it's not what I want.
if (($("element").data('bs.modal') || {}).isShown) {
$('#action-description').val('Update');
} else {
$('#action-description').val('Create');
}
And the input field:
<input type="text" id="action-description" name="action-description" value="">
I need to make something on change so I also tried like this:
$('#modalElement').on('hidden', function(){
$('#action-description').val('Create');
});
But I can't make it work!