Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify that Chosen plugin initialized on element

Is there a standard way to know that jQuery plugin already initialized at specific HTML element?

I want to make some actions if for example select element is under Chosen plugin.

like image 758
Index Avatar asked Apr 22 '15 07:04

Index


1 Answers

$("#elementId").data("chosen");

This will return the chosen object assigned to the element, or undefined if not assigned.

Note: For other plugins or JQuery versions I worked with, you may need to check the plugin name suffixed with "Obj":

$("#elementId").data("pluginNameObj");
like image 68
Javier Rey Avatar answered Sep 22 '22 04:09

Javier Rey