“Evento Javascript Bind” Respostas de código

JQuery Bind Clique

$( "#foo" ).bind( "click", function() {
  alert( "User clicked on 'foo.'" );
});
Sticky Pingu

Evento de ligação ao JavaScript ao elemento criado

// bind click handler to element that is added later/dynamically
document.addEventListener('click', function(e){
    if(e.target && e.target.id== 'myDynamicallyAddedElementID'){
         //do something
    }
});

//Alternatively, if your using jQuery:
$(document).on('click','#myDynamicallyAddedElementID',function(){
    //do something
});
Grepper

Evento Javascript Bind

hello hi how are you
Uday Bhensdadiya

Função do ouvinte de eventos chamado parâmetros

var someEventHander=function(event,param1,param2){
	console.log(event,param1,param2);
}
//add listener
document.getElementById("someid").addEventListener('click',someEventHander.bind(event,'param1','param2'), false);
Lucky Lark

Respostas semelhantes a “Evento Javascript Bind”

Perguntas semelhantes a “Evento Javascript Bind”

Mais respostas relacionadas para “Evento Javascript Bind” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código