Note that there are some explanatory texts on larger screens.

plurals
  1. POadd and remove div with click event
    primarykey
    data
    text
    <p>i have to add 2 div one by one on click event after this the add button will be disable and when i remove the first or second added div the add button will be enable here is my code.. here is <a href="http://jsfiddle.net/arun_/XeSnu/5/" rel="nofollow">jsfiddle</a></p> <p><strong>HTML</strong></p> <pre><code>&lt;a id="addMoreroom" class="fnt-size13" href="#"&gt;+ Add Rooms&lt;/a&gt; &lt;div id="roomDiv-1" class="rowG clearfix hide"&gt; &lt;label&gt;Selected Room Type&lt;/label&gt; &lt;select&gt; &lt;option&gt;1&lt;/option&gt; &lt;/select&gt; &lt;label&gt;Number Of Rooms&lt;/label&gt; &lt;select&gt; &lt;option&gt;3&lt;/option&gt; &lt;/select&gt; &lt;a id="rmoveRoom_1" class="fnt-size13" href="#"&gt;- Remove&lt;/a&gt; &lt;/div&gt; &lt;div id="roomDiv-2" class="rowG clearfix hide"&gt; &lt;label&gt;Selected Room Type&lt;/label&gt; &lt;select&gt; &lt;option&gt;1&lt;/option&gt; &lt;/select&gt; &lt;label&gt;Number Of Rooms&lt;/label&gt; &lt;select&gt; &lt;option&gt;3&lt;/option&gt; &lt;/select&gt; &lt;a id="rmoveRoom_2" class="fnt-size13" href="#"&gt;- Remove&lt;/a&gt; &lt;/div&gt; </code></pre> <p>jQuery </p> <pre><code>$("#addMoreroom").click(function () { $('#roomDiv-1').addClass('show'); $('#addMoreroom').attr('id', 'addMoreroom1'); $("#addMoreroom1").click(function () { $('#roomDiv-2').addClass('show'); $(this).hide(); return false; }); }); $("#rmoveRoom_1").click(function () { $('#roomDiv-1').remove(); $('#addMoreroom1').show(); return false; }); $("#rmoveRoom_2").click(function () { $('#roomDiv-2').remove(); $('#addMoreroom').show(); $('#addMoreroom1').attr('id', 'addMoreroom'); return false; }); }); </code></pre> <p>the problem is whenever i click on remove button the loop will sucked and add button will be not visible please provide me some suggestion.. </p>
    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