Jump to content


This topic is now archived and is closed to further replies.


OnClick Function Help

Recommended Posts

Ok, here's the deal:

I have a dropdown that has the values No(selected) and Yes
I want to have an invisible dropdown that will show if the user selects Yes above, and dissapear if they change it back to know.

Things to know:

My form name is "file_editor"
My Yes/No dropdown name is "is_backup"
My function for this is called "showSelect"

Thanks for all help!!

Share this post

Link to post
Share on other sites
Modify as needed:

    function showDiv(a) {
        if (a.selectedIndex == 0) {
            document.getElementById('hiddendiv').style.display = "none";
        } else {
            document.getElementById('hiddendiv').style.display = "block";

<select onchange="showDiv(this)" name="select1">
    <option selected value="y">Yes</option>
    <option value="n">No</option>

<div id="hiddendiv" style="display: none;">
<select name="select2" id="select2">
    <option selected value="0">0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.