How to interact with an existing coralUI component?
I'm trying to work out the best way to interact with an existing coralUI component that is on the page, e.g. a checkbox. To give an example, my AEM component dialog has a checkbox on it. I want to interact with the checkbox via javascript, I can do things like update the state etc via JQuery basically ignoring the fact it is a coralUI checkbox however I can see in the coralUI documentation there is a nice API for doing this e.g. instance.indeterminate or instance.invalid
I can see how I can use these properties/methods if I create a new checkbox via JavaScript e.g.
var checkbox = new Coral.Checkbox().set({ label: { innerHTML: "CoralUI Rocks" }, value: "kittens" });but how can I read the checkbox from the DOM and transform it into the same object above? I'd imagine something like this:
var checkbox = new Coral.Checkbox($(#myCheckBoxID));
obviously that doesn't work but is there a way to achieve what I want?