title: How to invoke nicEdit (editbox) or jquery (datepicker for text box) after a XMLHttpRequest?
body: <p>Need help (or an example) as I don't seems to be able to invoke jquery datepick or nicEdit when using XMLHttpRequest.</p>
  
  <p>My code comes with 4 php files:</p>
  
  <pre><code>&lt;p&gt;Main page:&amp;nbsp;main.php&lt;br /&gt;
    ++++++++++++++++++&lt;br /&gt;
    &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Strict//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;meta http-equiv=&amp;quot;content-type&amp;quot; content=&amp;quot;text/html; charset=utf-8&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Education Centre&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;link href=&amp;quot;style.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; media=&amp;quot;screen&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;script.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;mainjs.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;http://js.nicedit.com/nicEdit-latest.js&amp;quot; type='text/javascript'&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;bkLib.onDomLoaded(nicEditors.allTextAreas);&amp;lt;/script&amp;gt;&lt;/p&gt;
  &lt;p&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body onLoad=&amp;quot;init_table();&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;form name='form1'&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;&amp;amp;nbsp;&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;showTable&amp;quot;&amp;gt;        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/form&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;!-- end page --&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt;&lt;br /&gt;
  &lt;/p&gt;
  &lt;br /&gt;
  
  
  &lt;p&gt;mainjs.js&lt;br /&gt;
    +++++++++&lt;br /&gt;
    function init_table() {&lt;br /&gt;
    requestInfo('showMain.php?mode=list&amp;amp;prev_cid=1','showTable','');&lt;br /&gt;
    }&lt;/p&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;p&gt;script.js [copied and tested to be ok with other pages]&lt;br /&gt;
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
    function getHTTPObject() {&lt;br /&gt;
    var xmlhttp;&lt;br /&gt;
    &lt;br /&gt;
    if(window.XMLHttpRequest){&lt;br /&gt;
    xmlhttp = new XMLHttpRequest();&lt;br /&gt;
    }&lt;br /&gt;
    else if (window.ActiveXObject){&lt;br /&gt;
    xmlhttp=new ActiveXObject(&amp;quot;Microsoft.XMLHTTP&amp;quot;);&lt;br /&gt;
    if (!xmlhttp){&lt;br /&gt;
    xmlhttp=new ActiveXObject(&amp;quot;Msxml2.XMLHTTP&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    return xmlhttp;&lt;br /&gt;
    }&lt;/p&gt;
  &lt;p&gt;var http = getHTTPObject(); // We create the HTTP Object&lt;/p&gt;
  &lt;p&gt;function requestInfo(url,id,redirectPage) { &lt;br /&gt;
    var temp=new Array();&lt;br /&gt;
    http.open(&amp;quot;GET&amp;quot;, url, true);&lt;br /&gt;
    http.onreadystatechange = function() {&lt;br /&gt;
    if (http.readyState == 4) {&lt;br /&gt;
    if(http.status==200) {&lt;br /&gt;
    var results=http.responseText;&lt;br /&gt;
    if(redirectPage==&amp;quot;&amp;quot; || results!=&amp;quot;1&amp;quot;) {&lt;br /&gt;
    var temp=id.split(&amp;quot;~&amp;quot;); // To display on multiple div &lt;br /&gt;
    var r=results.split(&amp;quot;~&amp;quot;); // To display multiple data into the div &lt;br /&gt;
    if(temp.length&amp;gt;1) {&lt;br /&gt;
    for(i=0;i&amp;lt;temp.length;i++) { &lt;br /&gt;
    document.getElementById(temp[i]).innerHTML=r[i];&lt;br /&gt;
    }&lt;br /&gt;
    } else {&lt;br /&gt;
    document.getElementById(id).innerHTML = results;&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    } else {&lt;br /&gt;
    window.location.href=redirectPage; &lt;br /&gt;
    }&lt;br /&gt;
    } &lt;br /&gt;
    }&lt;br /&gt;
    };&lt;br /&gt;
    http.send(null);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;/p&gt;
  
  &lt;br /&gt;
  &lt;p&gt;showMain.php&lt;br /&gt;
    ++++++++++++&lt;br /&gt;
    &amp;lt;?php&lt;br /&gt;
  header('Content-Type: text/xml');&lt;/p&gt;
  &lt;p&gt;//include(&amp;quot;config.php&amp;quot;);&lt;br /&gt;
    //include(&amp;quot;mysql.lib.php&amp;quot;);&lt;br /&gt;
    //$obj=new connect;&lt;br /&gt;
    &lt;br /&gt;
    $netwkinfo = &amp;quot;Some information pulled from database&amp;quot;;&lt;br /&gt;
    echo &amp;quot;&amp;lt;table&amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;My Data&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;&amp;lt;textarea id='netwkinfo' cols='75' rows='5' &amp;gt;&amp;quot; . $netwkinfo . &amp;quot;&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
    ?&amp;gt;&lt;br /&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>showMain.php is a file that extract data from a database to be displayed/edited etc... but for simplicity i assign a value to $netwkinfo.</p>
  
  <p>What I will like to see is nicEdit feature (panel) shown at the editbox. Unfortunately I am not seeing it, just a plain edit box appears. What could be wrong and how should i correct it for it to work. </p>
  
  <p>Similarly <b>IF</b> I used jquery datepicker on a textbox in the showmain.php, i am not seeing it work too.  I think its the same concept but just couldn't figure out how to get them working.</p>
  
  <p>Appreciate any help here.
  Thanks.</p>