$('form').each(function(){
var form = this;
$('a', this).click(function(){ form.submit(); });
});
Is there any way I can get the parent (this
) element inside of that click function, without using a intermediate variable? I was thinking that maybe there's a keyword I'm not aware of that lets you do it.
In the $.ajax function there's a context
paramters which allows you to do something like this.
No, you have done it the best way. Convention suggests using that:
var that = this;
$('a', this).click(function(){ that.submit(); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With