Return to Snippet

Revision: 32587
at September 29, 2010 17:34 by Meander365

Initial Code
<!DOCTYPE html>
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../assets/js/jquery.js"></script>

<script type="text/javascript">
$(function () {

	$('#animate').bind('click', function(e){
		// Do something with, e.surname, etc.
		var newHtml = e.type || [];
			newHtml = e.from || $(this).attr("id");
			newHtml += || [];
			newHtml += e.surname || [];
			newHtml += e.age || [];		
			newHtml += e.gender || [];	


	$('#animate-fake').mouseover(function() {
			type:'click', //the bound event of the handler
			age: 28,
<style type="text/css">
	.box {width:100%;min-height:30px;background:#efefef;border:1px solid #ccc;}
	<a href="#" id="animate">Show me the object</a><br /><br />
	<div class="box"></div><br /><br />
	<a href="#" id="animate-fake">Hover Over Me</a>


Initial URL

Initial Description
I can see this being useful for when you want to pass a lot of associated data to an event handler from elements and their chosen trigger action.

Initial Title
Jquery Passing Dynamic Data to Event Handlers

Initial Tags
javascript, data, jquery

Initial Language