使用$( this )与使用$(This)之间的根本区别是什么
$('.viewComments').click(function(ev){
//returns the desired value
alert(this.getAttribute('id'));
//Gives an error sayin function is not defined
alert($(this).getAttribute('id'));
//returns the desired value
alert($(this).attr('id'));
});
我认为"$(this)“将包含"this”所具有的所有函数,而more..But似乎不是这样的。
那么$(this)到底是什么呢?和
当我使用它时,我怎么知道有哪些功能可用?(我知道我可以让他们通过firebug。但我想知道是否有其他方法-一些文档可能是)
https://stackoverflow.com/questions/3633270
复制相似问题