7
Being here doing my sites on php/mysql/html/css
and learning more and more about jQuery
I found myself in the situation where I should use the same code for two ids
distinct.
How to proceed when you need to use the same code in two different places to run the same script that in this case is to open and close a slideToggle in a top form? As far as I know jQuery takes it when we duplicate an id on the same page because by logic, id is identity, is unique.
jQuery(function(){
jQuery("#botaodeacao").click(function(e) {
jQuery("#oformulario").slideToggle(1500);
});
jQuery("#botaodeacao2").click(function(e) {
jQuery("#oformulario").slideToggle(1500);
});
e.preventDefault();
});
All right, we can do it by class, but if you need to do it with ids
...
Thank you @Jader. The people on this portal really are a special people. This is great information knowing that ps selectors work the same way because I’m great at CSS, it will be easier to learn.
– Marcos Vinicius