Welcome Guest, Not a member yet? Register   Sign In
enable / disable button based on record inserted
#2

Code:
DOM:
---------------------------------------------------

document.getElementById("myBtn").disabled = true;

buttonObject.disabled = true|false

JavaScript:
---------------------------------------------------

<div class="click">Click me to Disable/Enable a html button</div>
<div class="showup">
   <input id="Button" type="button" value=" + " style="background-color:grey" />
</div>

// Demo using plain javascript
var button   = document.getElementById("Button");
var clickBtn = document.getElementsByClassName('click')[0];

// Disable the button on initial page load
button.disabled = true;

//add event listener
clickBtn.addEventListener('click', function(event) {
   button.disabled = !button.disabled;
});

button.addEventListener('click', function(event) {
   alert('Enabled!');
});


CSS:
---------------------------------------------------

.showup {
   width: 100px;
   height: 100px;
}

.click {
   cursor: pointer;
   padding-bottom: 10px;
}

Try one of those
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: enable / disable button based on record inserted - by InsiteFX - 09-18-2018, 03:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB