Enable a button after another button is clicked and form is submitted

I have two buttons which submit button and save button. The save button is disabled by default so when the submit button is clicked and the form is submitted, the save button will be enabled. Right now what i had done is only the submit button will be disable after I clicked. But I don’t know how to make the save button enable after submit button is disabled.

<!DOCTYPE html>
<html>
	<head>
		<title></title>
	</head>
	<body>
		<form action="" method="post" class="form-disable">
			<input type="text" name="name" placeholder="name"/>
			<button type="submit" class="btn btn-default" name="roll" <?php echo isset($_POST['roll']) ? 'disabled="true"' : ''; ?> >Roll Branch </button> 			
			<button type="submit" name="clicked" id="clicked" onblur="validate()" disabled value="true" >Roll Branch </button> 
			<script>
				function validate() {
					
					$("#clicked").attr("disabled",true);
					if(valid) {
						$("#clicked").attr("disabled",false);
					}	
				}
			</script>
		</form>		
	</body>
</html>

Can you give us the code to help you?

i have edit my question.

HTML:

<button type="submit" id="roll" class="btn btn-default">Roll Branch </button> 			
			<button type="submit" name="clicked" id="clicked" onblur="validate()" disabled="true">Roll Branch </button>

JQuery Code:

$('#roll').on('click',function(){
  $('#roll').attr('disabled', true);
  $('#clicked').attr('disabled', false);
});
$('#clicked').on('click',function(){
  $('#roll').attr('disabled', false);
  $('#clicked').attr('disabled', true);
});

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.