Thursday, October 30, 2008

[jQuery] $(this) question

Hi!

I have this in html:
<a href="javascript:addSubject();">add</a>

and this in js:
function addSubject() {
alert( $(this).attr("href") );
}
/* expected output:
*
*javascript:addSubject();
*
*/

I tried some alternate method but those not works neither... What is
the problem ?

Thomas

No comments: