Jquery get selector
I have this jquery script :
$.fn.myFoo = function(){
alert(this.selector)
alert($(this).selector);
}
then i call it like so.
$('#myID').myFoo();
I need but it returns empty: i need it to return "myID" i ca开发者_如何转开发n't seem to find a way to do this can some one help please?
If you need to get the id then you can use
$(this).attr ( "id" );
inside the function.
See attr
精彩评论