1

If I select elements to enable jQuery plugins like

$(".clickaway").clickaway();

Can I somehow get the selector .clickaway that was used in the plugin?

Jiew Meng
  • 84,767
  • 185
  • 495
  • 805

2 Answers2

3

I'm sure you would have noticed it digging into the object using Firebug, but just the .selector property of the jQuery object.

Agent_9191
  • 7,216
  • 5
  • 33
  • 57
  • 2
    Note: The `.selector` property was deprecated in jQuery 1.7 and **removed in jQuery 1.9**. – acdcjunior Jul 11 '13 at 17:38
  • Please have a look at my answer to a similar question... https://stackoverflow.com/a/46165306/2358222 This is a solution I came up with after loads of digging around on the web and in chrome's console. – Studocwho Sep 11 '17 at 22:46
-1

try:

$(".clickaway").clickaway().end()....

is that what you mean?

simon
  • 15,344
  • 5
  • 45
  • 67
  • Actually I want the selector string ".clickaway" that I can use within my plugin `(function($) { $.fn.clickaway = function() { // I want to use that string here } })(jQuery)` – Jiew Meng Jan 13 '11 at 07:11
  • sorry - misunderstood your question. Agent_9191 seems to have nailed it :) – simon Jan 13 '11 at 09:32