2
How do I make for a div
appear when a button is disabled, and when enabled I want this div
stay hidden
$(document).on('ready', '#btn-cadastra-atividade', function ()
{
$this = $(this)
if($this.attr('disabled') === true)
{
$('#erroAtividade').show();
}
else
{
$('#erroAtividade').hide();
}});
I adapted it but it didn’t work, I put the code in the question
– Isa
But what exactly do you want to do with the button ? To fire the 'onready' event, you need to specify the document, and then the event, in case you did it right, but the 'ready' will not fire, you need a Mutation or equivalent, something like: $(Document). on('Domnodeinserted', '#btn-register-activity', Function() .
– AnthraxisBR
There would be no direct action on the button, just wanted the function to listen when this button was disabled to display the div, and when enabled, hide the same div
– Isa
So this 'Domnodeinserted' event is supposed to work, but you’ll need to find the equivalent upgraded mode for it, because this soon won’t work anymore.
– AnthraxisBR
From a glance at snnipet I added the answer.
– AnthraxisBR
It didn’t work :( it displayed Alert but didn’t do the div action
– Isa
It gives yes, you need to add the 'disabled' to the button, if you have the attr disabled, it shows the div, if you do not have the attr disabled the div is hidden. In the example it is without the disabled, in case it hides the div, if you add 'disabled' to the button, the div is displayed.
– AnthraxisBR