jquery - what is the better way to review my code on several events occur one element -


today see code, want review code.but me,some question occured.the questions between 2 param code.

$('.industry p').on('click mousenter', 'a', function(e) {    // code  } 

the first question me that,when 2 events occur, way separate them not simple,sometimes using bad method, , ctrl+z. , other question :

$('.industry p').on('click', 'a ,b ', function(e) {  // code } 

above 2 question not wise review code, del unnecessary parts. direct question code following:

$('.industry p > a').mouseenter(function() {     var index = $(this).index()     pall.filter(':visible').hide()     pall.eq(index).show()    //console.log($(this).get()); })  $('.industry p').on('click', 'a', function(e) {  $(this).toggleclass('choose').siblings().removeclass('choose');  var value = $(this).text();  $('.industry input').val(value);  var dataid = $(this).data('id');  $('.industry input').attr('data-id', dataid); }); 

if want remove unnecessary part, can begin?


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -