I've got a page using materializecss that starts with these link buttons disabled. I want to use JavaScript to enable them.
tried - changing the .class property to remove "disabled" tried - changing the .disabled property to false
<ul class="tabs tabs-transparent">
<li><a class="waves-effect waves-yellow btn-flat white-text" href="<?=ScriptApp.getService().getUrl();?>?v=zapAdmin" disabled="true" >Zap Admin</a></li>
<li><a class="waves-effect waves-yellow btn-flat white-text" href="<?=ScriptApp.getService().getUrl();?>?v=nzap" disabled="true">Create Zap</a></li>
<li><a class="waves-effect waves-yellow btn-flat white-text" href="<?=ScriptApp.getService().getUrl();?>?v=reports" disabled="true" >Reports</a></li>
<li><a class="waves-effect waves-yellow btn-flat white-text" href="<?=ScriptApp.getService().getUrl();?>?v=extra" disabled="true">EXTRA</a></li>
</ul>
function refUser(access) {
if (access == 'granted') {
var div = document.getElementsByClassName("tabs tabs-transparent")[0];
var links = div.getElementsByTagName('a');
console.log(links);
for(i=0;i<links.length;i++){
var link = links[i];
link.disabled=false;
}
}
}
Try to remove the waves-effect waves-yellow white-text
classes before add disabled
class
Seems that a similar question was already asked. Check out and see if some answer works for you.
Visit How to disable button using jquery in materialize css.