• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.