Jquery accordion

Jquery accordion

The code below creates and deletes the content of the accordion <div id="accordion">.  With the initial accordion population everything works properly ie the proper content is generated and the "accordion action" works. But once the the <div id="accordion"> is emptied and re populated all the content is correct, but the "accordion action" does not work ie everything is expanded..

Please comment

  1. Kinetic.Layer.prototype.omniLoadPropertiesPallet = function(node){

  2. attrs= node.getAttrs();

  3. for (key in attrs) {
  4.         if (attrs.hasOwnProperty(key)) {
  5. $("#accordion").append(
  6. "<h3 class=\"accordinH3\" >("+typeof attrs[key]+") "+key+"= "+attrs[key]+"</h3>"
  7.    +"<div><p>"
  8. +" <input type=\"button\" class=\"down\" id=\""+key+":down:"+typeof attrs[key]+"\"  value=\"&#9660;\" />"
  9. +"<input type=\"button\" class=\"up\" id=\""+key+":up:"+typeof attrs[key]+"\" value=\"&#9650\" />"
  10. +"<td><input type=\"text\" class=\"omniProperty\" id=\""+ key +"\" size=20 value=\""+ attrs[key]+"\">"
  11. +"</p></div>"  
  12. );
  13.          }//END if (attrs.hasOwnProperty(key)
  14.     }// End for (key in attrs)
  15. console.log("accordion call");
  16. $("#accordion").accordion();
  17. }// END Kinetic.Layer.prototype.omniLoadPropertiesPallet
  18. function omniUnloadPropertiesPallet(){
  19. $("#accordion").empty();
  20. }