jQuery UI accordion widget will not work with dynamically created HTML
Im trying to implement jQuery UI accordion in a "context sensitive" object properties palette. The content of the "accordion " <div> is dynamically created depending on the object selected.
- $("#accordion").append(
- "<h3><a href=\"#\">"+key+"</a></h3>"
- +"<div><p>"
- +" Attribute Information"
- +"</p></div>"
- );
Once this content is generated, the entire content is displayed but there is no accordion action. I can, however, use developer tools to go in and copy the HTML that was generated, and paste it into the "accordion " <div> and every thing works great.
The content generated by the above jQuery
- <div id="accordion" class="ui-accordion ui-widget ui-helper-reset" role="tablist"><h3><a href="#">x</a></h3><div><p> Attribute Information</p></div><h3><a href="#">y</a></h3><div><p> Attribute Information</p></div><h3><a href="#">width</a></h3><div><p> Attribute Information</p></div><h3><a href="#">height</a></h3><div><p> Attribute Information</p></div><h3><a href="#">fill</a></h3><div><p> Attribute Information</p></div><h3><a href="#">stroke</a></h3><div><p> Attribute Information</p></div><h3><a href="#">strokeWidth</a></h3><div><p> Attribute Information</p></div><h3><a href="#">draggable</a></h3><div><p> Attribute Information</p></div><h3><a href="#">sceneFunc</a></h3><div><p> Attribute Information</p></div><h3><a href="#">id</a></h3><div><p> Attribute Information</p></div><h3><a href="#">rotation</a></h3><div><p> Attribute Information</p></div><h3><a href="#">scaleX</a></h3><div><p> Attribute Information</p></div><h3><a href="#">scaleY</a></h3><div><p> Attribute Information</p></div><h3><a href="#">offsetX</a></h3><div><p> Attribute Information</p></div><h3><a href="#">offsetY</a></h3><div><p> Attribute Information</p></div><h3><a href="#">skewX</a></h3><div><p> Attribute Information</p></div><h3><a href="#">skewY</a></h3><div><p> Attribute Information</p></div></div>
- Please comment