Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding click event to dynamically generated accordians jquery
    primarykey
    data
    text
    <p>I have a widget which consists of dynamically generated tabs. Each tab consists of 7 accordians. As I generate the tabs dynamically I add the Accordians dynamically too. No what I need is a single click handler which has an event argument that specifies which accordian has been clicked so that i can add respective data to the div of that accordian. Code looks somewhat like this</p> <pre><code> &lt;div class='tab' id='idCallDetailTab'&gt; &lt;ul&gt; &lt;?php $i=0; foreach ($this-&gt;Asp as $item) { $i++; ?&gt; &lt;li&gt;&lt;a href="#etabs-&lt;?php echo $i; ?&gt;"&gt;&lt;?php echo $item['asp']; ?&gt;&lt;/a&gt;&lt;/li&gt; &lt;?php } ?&gt; &lt;/ul&gt; &lt;?php $i=0; foreach ($this-&gt;Asp as $item) { $i++; ?&gt; &lt;div id="etabs-&lt;?php echo $i; ?&gt;" &gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; var accordian = '&lt;div class="accordion"&gt;&lt;h4&gt;&lt;a href="#"&gt;CallLogin&lt;/a&gt;&lt;/h4&gt;&lt;div id="acclogin-&lt;?php echo $i; ?&gt;"&gt;&lt;/div&gt;&lt;h4&gt;&lt;a href="#"&gt;Call Allocate&lt;/a&gt;&lt;/h4&gt;&lt;div id="accallocate-&lt;?php echo $i; ?&gt;"&gt;&lt;/div&gt;&lt;h4&gt;&lt;a href="#"&gt;Call Attend&lt;/a&gt;&lt;/h4&gt;&lt;div id="accattend-&lt;?php echo $i; ?&gt;"&gt;&lt;/div&gt;&lt;h4&gt;&lt;a href="#"&gt;Call Dispatched&lt;/a&gt;&lt;/h4&gt;&lt;div id="accdispatched-&lt;?php echo $i; ?&gt;"&gt;&lt;/div&gt;&lt;h4&gt;&lt;a href="#"&gt;Call Part Indent&lt;/a&gt;&lt;/h4&gt;&lt;div id="accindent-&lt;?php echo $i; ?&gt;"&gt;&lt;/div&gt;&lt;h4&gt;&lt;a href="#"&gt;Call transfer&lt;/a&gt;&lt;/h4&gt;&lt;div id="acctransfer-&lt;?php echo $i; ?&gt;"&gt;&lt;/div&gt;&lt;h4&gt;&lt;a href="#"&gt;Call Part Recieved&lt;/a&gt;&lt;/h4&gt;&lt;div id="accreceived-&lt;?php echo $i; ?&gt;"&gt;&lt;/div&gt;&lt;/div&gt;'; $('#etabs-&lt;?php echo $i; ?&gt;').html(accordian); $('#acclogin-&lt;?php echo $i; ?&gt;').html('100'); $('#accallocate-&lt;?php echo $i; ?&gt;').html('200'); $('#accattend-&lt;?php echo $i; ?&gt;').html('300'); $('#accdispatched-&lt;?php echo $i; ?&gt;').html('400'); $('#accindent-&lt;?php echo $i; ?&gt;').html('500'); $('#acctransfer-&lt;?php echo $i; ?&gt;').html('600'); $('#accreceived-&lt;?php echo $i; ?&gt;').html('700'); &lt;/script&gt; &lt;?php } ?&gt; &lt;/div &gt; </code></pre> <p>I hope you are getting what my problem is. Please help me out</p>
    singulars
    1. This table or related slice is empty.
    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.
    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