I am building a jQuery Plugin which gets applied on a container element like that.
$('#container').myPlugin();
In this plugin I am trying to get the same element from another page trough .get()
.
$.get('page.php', function(data) {
data = $.parseHTML(data);
data = $('<div/>').html(data);
data = data.find( myContainer );
}, 'html');
The problem is the myContainer
-variable. I need the CSS-selector, which was applied to my plugin, is there any way I can get it?
I have found this solution, but it seems fairly complex. Maybe there is an easier solution especially for my case (plugin not object)?!
I could use another option in my plugin to get the selector, but I would like to avoid it, since it would feel like doubled information for the user. (Applying the plugin to the container and reference it in options).