Note that there are some explanatory texts on larger screens.

plurals
  1. POminify Javascript code for showing and hiding lots of data
    primarykey
    data
    text
    <p>Script : </p> <pre><code>$(document).ready(function () { $("#finance").hide(); $("#HR").hide(); var slz = jQuery('#specialization'); var select = this.value; slz.change(function () { if ($(this).val() == '2') { $('#finance').show(); $('#HR').hide(); } if ($(this).val() == '3') { $('#HR').show(); $('#finance').hide(); } if ($(this).val() == '1') { $('#finance').hide(); $('#HR').hide(); } }); }); </code></pre> <p>HTML : </p> <pre><code>&lt;select name="specialization" id="specialization"&gt; &lt;option value="1" id="1"&gt;select specialization&lt;/option&gt; &lt;option value="2" id="2"&gt;Finance&lt;/option&gt; &lt;option value="3" id="3"&gt;Human Resource&lt;/option&gt; &lt;option value="4" id="4"&gt;Information Technology&lt;/option&gt; &lt;option value="5" id="5"&gt;Marketing&lt;/option&gt; &lt;option value="6" id="6"&gt;Material Management&lt;/option&gt; &lt;option value="7" id="7"&gt;Operations&lt;/option&gt; &lt;option value="8" id="8"&gt;Supply Chain Management&lt;/option&gt; &lt;/select&gt; &lt;div id="specialization_subjects"&gt; Specialization Subjects &lt;/div&gt; &lt;ul id="finance"&gt; &lt;li&gt;Financial Institution &amp; Services&lt;/li&gt; &lt;li&gt;International Financial Management&lt;/li&gt; &lt;li&gt;Working Capital Management&lt;/li&gt; &lt;li&gt;Project Work&lt;/li&gt; &lt;/ul&gt; &lt;ul id="HR"&gt; &lt;li&gt;Financial Institution &amp; Services HR&lt;/li&gt; &lt;li&gt;International Financial Management&lt;/li&gt; &lt;li&gt;Working Capital Management&lt;/li&gt; &lt;li&gt;Project Work&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Hi every one I have given my javascript and html code for showing and hiding the ul according to the selected dropdown value.. this code works for me fine..but i wanted to minify the javascript file ..because I have lots of ul and lots of drop down..</p> <p>I wanted to remove the if else condition and wanted to use for loop for this to work by storing values in arrays etc..</p> <p>Thanks In advance Please Help</p>
    singulars
    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