Skip to main content

I have a Custom Component with an id of cTest. However I can’t access it with the jQuery id selector. The inline code is


var element = argumentst0], $ = skuid.$; element.html('Hello <b>world!</b>'); // This works ok $('#cTest').html('Goodbye world'); // This does not work

What am I doing wrong?

At this point in the code, your Custom Component’s element is not yet in the DOM, so jQuery cannot find it. Immediately after this Custom Component definition is finished, the element will be added to the DOM, and accessible via jQuery. Therefore, from within your Custom Component definition, you have to use the element variable, as this is the only way to get at the DOM element.