Why am i obtaining different result calling same method using direct javascript call and throw jquery event handler?
In next example, i want show alert with a text. Using jquery, result is "undefined":
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
<script type="text/javascript">
function test(str) {
this.str = str;
this.testing = function testing() {
alert(this.str);
}
}
var t;
$(document).ready( function() {
t = new test('xx');
$('#jq').click(t.testing);
}
);
</script>
</head>
<body>
<a href="#" onclick="javascript: t.testing(); return false;">test direct call</a>
<a id="jq" href="#">test call throw jquery</a>
</body>
</html>
Thanks