In an earlier question, I developed how to store objecthow properties. Now I'm trying to access those propertiesthat are objectpassed through an event, but cannot make it work:
<script language="javascript">
$(document).ready(function() {
function TestObject() {
this.testProperty = "green";
}
var testObject = new TestObject();
var test;
test = $('#test');
jQuery.data(test, "obj", testObject);
alert(jQuery.data(test, "obj").testProperty);
$('#test').click(TestClick);
function TestClick() {
alert($(this).attr("id"));
alert(jQuery.data($(this), "obj").testProperty);
};
});
</script>
<body>
<form id="form1" runat="server">
<div id="test">Here is a test div</div>
</form>
</body>
source
share