Note that there are some explanatory texts on larger screens.

plurals
  1. POSelect categories
    primarykey
    data
    text
    <p>im a beginer and im a bit stuck with my code.</p> <p>I have categories in an array, im listing them in a drop down box.</p> <p>And i would like to do that every categori has a different form. like Films have a Film form music has a music form.</p> <pre><code>&lt;script&gt; $('document').ready(function() { $('.valami').change(function() { $('select.valami option:selected').each(function() { var data = $(this).text(); switch(data) { case 'Film': alert('Film'); break; case 'Sorozat': alert('Sorozat'); break; case 'Zene': alert('Zene'); break; case 'XXX': alert('XXX'); break; case 'Játék': alert('Játék'); break; case 'Program': alert('Program'); break; case 'Könyv': alert('Könyv'); break; default: 'Film'; } });//each });//change });//ready &lt;/script&gt; </code></pre> <p>here is the code, with the alrest i was just testing if it works.</p> <p>my problem is i ambel to make it if a category is selected, the form slides down, but if i select the other one the one selected before wont get hidden.</p> <p>i tryed like this</p> <pre><code>if($('.film').is(':hidden')) { $('.film').show(); }else { $('.film').hide(); } </code></pre> <p>Its working but if i select a nother categorie it stays there, can someone give me a hint what im missing?</p> <p>Thank You</p> <p>html</p> <pre><code>&lt;select name='kategoriak' class='valami'&gt; &lt;?php foreach ($kategoria as $k) { ?&gt; &lt;option value="&lt;?php echo $k['id'] ?&gt;"&gt;&lt;?php echo $k['nev'] ?&gt;&lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; &lt;div class='film'&gt;teh form here&lt;/div&gt; </code></pre> <p>an the other forms like the film , and its defined as a display none in the css</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.
    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