I know little about 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
of the button, that is, if I have more than one button on the page and need to call div
will not work. I need to change the function to get the button by parameter in 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);
});
});