Add second element to "click" javascript event

Asked

Viewed 35 times

0

I have javascript code that loads data at the click of a button, I would like to know how to load this same information on another button, IE, I would like to add one more element to the excerpt:

$(function () { $(".glyphicon-search"***SEGUNDO ELEMENTO AQUI***).click(function () {

Follow the JAVASCRIPT code

$(function () { $(".glyphicon-search").click(function () {
var id_codigo = $(this).data('codigo');
var id_situacao = $(this).data('situacao');
        
$(".modal-body #id_codigo").val(id_codigo);
$(".modal-body #id_situacao").val(id_situacao);
})
})

1 answer

0


The jQuery selector accepts multiple elements, just separate them by a comma:

$("seletor1, seletor2, seletor3 etc.")

Browser other questions tagged

You are not signed in. Login or sign up in order to post.