Note that there are some explanatory texts on larger screens.

plurals
  1. POjs not working inside div after ajax response
    text
    copied!<p>When i populated div with ajax response html, My js not working it that div. Below i showed the html and ajax function.</p> <h3>JS</h3> <pre><code>$(document).ready(function() { $('.submit').on('click', function(){ var id = (typeof $(this).attr('id') === 'undefined') ? "" : $(this).attr('id'); var color = (typeof $("#"+ id + " #userColor").val() === 'undefined') ? "" : $("#"+ id + " #userColor").val() ; var size = (typeof $("#"+ id + " #userSize").val() === 'undefined') ? "" : $("#"+ id + " #userSize").val(); var qty = (typeof $("#"+ id + " #userQuantity").val() === 'undefined') ? "" : $("#"+ id + " #userQuantity").val(); $('#demo-header').load(baseUrlForExternalJS.baseUrl + "cart/add_cart", {'id':id,'color':color,'size':size,'qty':qty}, function () { $('#mask , .cart-popup').fadeOut(300 , function() { $('#mask').remove(); }); }); }); }); </code></pre> <h3>HTML</h3> <pre><code>&lt;div id="demo-header"&gt; &lt;a id="cart-link" href="#cart" title="Cart"&gt;&lt;?php echo $this-&gt;cart-&gt;total_items(). " Items - $".$this-&gt;cart-&gt;total(); ?&gt;&lt;/a&gt; &lt;div id="cart-panel"&gt; &lt;div class="item-cart"&gt; &lt;table&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td class="image"&gt;&lt;a href="product.html"&gt;&lt;img width="60" height="60" src="&lt;?php echo base_url(); ?&gt;resources/images/products/product-thumb-1.jpg" alt="product" title="product"&gt;&lt;/a&gt;&lt;/td&gt; &lt;td class="name"&gt;&lt;a href="product.html"&gt;Women's Saucony&lt;/a&gt;&lt;/td&gt; &lt;td class="quantity"&gt;x&amp;nbsp;1&lt;/td&gt; &lt;td class="total"&gt;$59.95&lt;/td&gt; &lt;td class="remove"&gt;&lt;i class="icon-remove"&gt;&lt;/i&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- /login-panel --&gt; </code></pre> <p>after i replaced HTML with response my link wont work.</p>
 

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