title: Calling jQuery UI constructors
body: <p>I am building a survey tool that will have different layouts and 'inquisitorial' processes depending on the part and actual question that the user is responding too. I am building this in Coldfusion and I am using jQuery UI elements to present questions however this will lead to ui elements embedded in ui elements.</p>
  
  <p>The order in which the UI elements are constructed or triggered is going to be the reverse order that they are presented in the html, so the innermost element has to be triggered first. There is a master page that has the logic that looks up the database for the question information and the specific page layout to use, which is then <code>&lt;cfinclude'd</code>, this layout page may have say tabular UI elements   </p>
  
  <p>My solution to this has been to declare an array of UI html node names (DIV tags) along with the UI construction method. Each included element then "pushes" it's UI information into this array. </p>
  
  <pre><code>var inst_triggers = new Array()
  inst_triggers.push("#accordion@@accordion()")
  </code></pre>
  
  <p>finally when everything is assembled I need to trigger these UI elements, so in the master page I do the following.</p>
  
  <pre><code>$(function() {
      var it = inst_triggers.reverse();
      var it_len = it.length;
  
      for (e=0;e&lt;it_len;e++){
          var trig_parts = it[e].split('@@');
      //do the jQuery UI element trigger here
      var eval_str = '$("'+trig_parts[0]+'").'+trig_parts[1];
      eval(eval_str);
      }
  
  });
  </code></pre>
  
  <p>As we know "eval() " is evil so I need an alternative to trigger or construct these page elements
  Something like <code>jQuery.uistuff.method('accordion')</code>, but I cannot see this in the documentation (or at least I have not understood what I have read which is more likely)</p>
  
  <p>Any suggestions, pointers further reading or references would be GREATLY appreciated.</p>
  
  <p>Regards thanks to the collective neural network in advance !</p>
  
  <p>Gus </p>