Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://jsfiddle.net/goldentoa11/P3hs8/1/" rel="nofollow">http://jsfiddle.net/goldentoa11/P3hs8/1/</a></p> <p>I added a parameter to your "SelectSubCat()" called txtValue. This is so you can pass the value you want to compare against.</p> <p>You'll need to call the "SelectSubCat()" function with the text field's value when you call it. I added an id to the text field called "selectText", and when I click the button I had added </p> <pre><code>onclick="SelectSubCat(document.getElementById('selectText').value)" </code></pre> <p>and this will call the function with the text of the input. Then instead of using the value from the form, it uses the value passed to it, and creates the appropriate sub category. Lastly, you need to change the Category's "onchange" function to just pass an empty string.</p> <pre><code>function SelectSubCat(txtValue) { if(txtValue == "") txtValue = document.drop_list.Category.value; // This line is to set txtValue to Category's value if the current value is blank. // In other words, if it was called by changing the dropdown, // give it the drop down's value. // ON selection of category this function will work removeAllOptions(document.drop_list.SubCat); addOption(document.drop_list.SubCat, "", "SubCat", ""); if (txtValue == 'Fruits') { addOption(document.drop_list.SubCat, "Mango", "Mango"); addOption(document.drop_list.SubCat, "Banana", "Banana"); addOption(document.drop_list.SubCat, "Orange", "Orange"); } if (txtValue == 'Games') { addOption(document.drop_list.SubCat, "Cricket", "Cricket"); addOption(document.drop_list.SubCat, "Football", "Football"); addOption(document.drop_list.SubCat, "Polo", "Polo", ""); } if (txtValue == 'Scripts') { addOption(document.drop_list.SubCat, "PHP", "PHP"); addOption(document.drop_list.SubCat, "ASP", "ASP"); addOption(document.drop_list.SubCat, "Perl", "Perl"); } } </code></pre>
    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