6
In my content management system, there is a checkbox in every item on the list, whether to edit, delete, view.. It turns out that this button appears all the time, and in case the user does not check anything, it is virtually useless.
I would like that, when some checkbox has been checked, the button appears, and if there is no checkbox, it disappears. Ah, if possible, a simple fadein and fadeOut effect.
HTML of checkboxes
<input type="checkbox" id="checkbox" name="deletar[]" value="<?php echo $row['id']; ?> " />
HTML of the button that should appear after:
<input type="submit" class="excluir-varios" value="Excluir selecionados" onClick="return confirm('Deseja realmente deletar os artigos selecionados?')">
Thanks, it’s all right. The only small flaw of the proposed is that, with opacity, if the user unlucky to click where the hidden icon is, the message will be displayed. However, it will not interfere with the code as it will not be possible to delete as nothing has been marked.
– Cobra
@Thiagobarros can put a display:None, but then you can’t animate with fade. Actually I would eliminate the onclick, and put something more friendly. Taking advantage, you can check if you have something selected, if you do not have, or trigger. However, I will improve this.
– Bacco
I happen to be totally lay in jquery and javascript, I think I can already see, because I didn’t know where to start with something so simple in the language. Alert really is a bit of a nuisance, but in my case it will serve to delete records from the database, so I think for now it will do. Anyway, thank you very much!
– Cobra
@Thiagobarros I fixed. now do not click more if it is hidden:
pointer-events:none
deactivates,pointer-events:auto
active. At least in newer browsers :) If you need older ones, you would have other techniques.– Bacco
Is this parameter CSS3? I’ve never read about.
– Cobra
https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
– Bacco
Perfect @Bacco, thank you.
– Cobra
If in case you had one
input
within atd
in the above example would work ?– KevinF