Phil Jackson
Phil Jackson

Reputation: 10288

Get selector used to init plugin within plugin

How to get the selector used to initialise a plugin within the plugin?

My first idea was to use $(this).attr('class'); but that would retrieve all classes set.

edit

$('.thisSelector').pluginName();

How can I retrieve this selector within the plugin?

Upvotes: 0

Views: 632

Answers (2)

T Nguyen
T Nguyen

Reputation: 3415

Actually, within a plugin, there is no need to wrap "this" in a jQuery function, so it's just

this.selector

Sorry I don't have enough reputation to add this as a comment.

Upvotes: 0

redsquare
redsquare

Reputation: 78667

$(this).selector see api docs

Upvotes: 4

Related Questions