1
I know little of javascript
and on my page I have a button that, when clicked, calls a div
. So far so good, but the function takes the id
button, ie if I put more than one button on the page and need to call the div
will not work. I need to change the function to grab the button by parameter in the onclick
and not fixed by id
.
How are you:
<button type="submit" id="submitbtn">//Gostaria de chamar a função no onclick passando qualquer botão como parametro
Function:
$(function () {
$("#submitbtn").click(function () {//Aqui seria a passagem do parâmetro
$("#loading").fadeIn();
var opts = {
lines: 12, // The number of lines to draw
length: 7, // The length of each line
width: 4, // The line thickness
radius: 10, // The radius of the inner circle
color: '#000', // #rgb or #rrggbb
speed: 1, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false // Whether to use hardware acceleration
};
var target = document.getElementById('loading');
var spinner = new Spinner(opts).spin(target);
});
});
Thanks Marciano, that’s right!
– Alexander Leão dos Reis
Mark it as accepted then ;)
– Marciano.Andrade
Sorry, I’m still new around here.
– Alexander Leão dos Reis
take a look at the [tour] then!
– Marciano.Andrade