Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to show tipboxes for dynamically added content?
    primarykey
    data
    text
    <p>I have a web page where some content is added via a javascript function call. Some items on the page have tipboxes assigned. For ones which are present since the page loading tipboxes are displayed. While for the dynamically added content they are not displayed. I use <a href="http://code.google.com/p/jquery-tipbox/downloads/list" rel="nofollow">http://code.google.com/p/jquery-tipbox/downloads/list</a> tipbox tool </p> <p>Sounds like the issue is unclear without example. So, the code</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" href="css/style.css" type="text/css"&gt; &lt;script src="js/jquery-1.7.2.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/jquery.tipbox.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/my_js_functions.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $().ready(function(){ $("#ele1_id").tipbox("tipbox message 1", 0); $("#ele2_id").tipbox("tipbox message 2", 0); $("#inc1").tipbox("tipbox message 3", 0); $("#inc2").tipbox("tipbox message 4", 0); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;center&gt; &lt;div style="visibility:visible" &gt; &lt;input id='ele1_id' type='radio' name='test' value='test1' onClick=get_fields(id,checked) &gt; test 1 option &lt;br&gt; &lt;input id='ele2_id' type='radio' name='test' value='test2' onClick=get_fields(id,checked) &gt;test 2 option &lt;br&gt; &lt;/div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td alighn=center&gt; &lt;div style='visibility:hidden' id='parameters'&gt;&lt;/div&gt; &lt;div style='visibility:hidden' id='parameters_extra'&gt;&lt;/div&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>my_js_functions.js :</p> <pre><code>function add_fields(name,value){ var target=document.getElementById('parameters_extra'); var content2=""; if (name == 'ele1_id') { if (value == 'sele1') { content2="&lt;table&gt;&lt;tr&gt;&lt;td id='inc1'&gt;\ &lt;b&gt; text to which I want to have tipbox assigned (tipbox message 3) &lt;/b&gt;&lt;/td&gt;\ &lt;td&gt;&lt;input type='text' maxlength=5 name='inp_value1' &gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; } else if (value == 'sele2') { content2="&lt;table&gt;&lt;tr&gt;&lt;td id='inc2'&gt;\ &lt;b&gt; another text for which 'tipbox message 4' has to appear &lt;/b&gt;&lt;/td&gt;\ &lt;td&gt;&lt;input type='text' maxlength=5 name='inp_value2' &gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; } } target.innerHTML = content2; target.style.visibility = "visible"; return false; } function get_fields(el,checked){ var target=document.getElementById('parameters'); var content; var target2=document.getElementById('parameters_extra'); target2.style.visibility = "hidden"; if (checked){ if (el == 'ele1_id') { content="&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;select one of the options:&lt;/b&gt;&lt;/td&gt;&lt;td&gt;\ &lt;select onChange=add_fields('ele1_id',this.options[this.selectedIndex].value) na me='ele1_id'&gt;\ &lt;option selected='selected' value='None'&gt;None&lt;/option&gt;\ &lt;option value='sele1'&gt;Selection 1&lt;/option&gt;\ &lt;option value='sele2'&gt;Selection 2&lt;/option&gt;\ &lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; } else if (el == 'ele2_id') { content="&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;select one of the options:&lt;/b&gt;&lt;/td&gt;&lt;td&gt; \ &lt;select onChange=add_fields('ele2_id',this.options[this.selectedIndex].value) name='ele2_id'&gt; \ &lt;option selected='selected' value='None'&gt;None&lt;/option&gt;\ &lt;option value='sele1'&gt;Selection A&lt;/option&gt;\ &lt;option value='sele2'&gt;Selection B&lt;/option&gt;\ &lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; } target.innerHTML = content; target.style.visibility = "visible"; } return false; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload