Knowledge Walls
John Peter
Pune, Maharashtra, India
How to pass multiple dynamic parameters with Jquery click event handler
5966 Views
HTML
<div id="users-info">
    <div data-userid="1001" data-userage="27">Raja</div>
    <div data-userid="1002" data-userage="32">Kumar</div>
    <div data-userid="1003" data-userage="45">Siva</div>
</div>
JQuery
$(function(){
    $("#users-info").on("click","div",function(event){
         alert("User id is : "+$(this).data("userid")+"; User age is : "+$(this).data("userage"));
    });
});
Output & Demo 
Previous Topics
Previous lessons of current book.
Computer software engineer articles of One day One Thing to Know
Computer software engineer articles of One day One Thing to Know
Best Lessons of "One day One Thing to Know"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details