0

I would like to know how you could add a help symbol beside a disabled option in a dropdown in html, if possible. I would like it so that when you click on the symbol it then tells you why that option has been disabled. Something similar to the dropdown below.

enter image description here

This is the basic code I have for the dropdown right now.

<select name="description" rows="4" class="form-control">
                <option value="RhinoTab"><?php echo _l('estimate_table_option1_1'); ?></option>
                <option value="RTi"><?php echo _l('estimate_table_option1_2'); ?></option>
                <option value="Magical Shit" disabled>Magical Shit</option>
              </select>
Tyler Fontaine
  • 131
  • 2
  • 12

1 Answers1

0

I ended up finding an example I was able to use as a work around to get my project working. Instead of having an icon it is when you click on the "disabled" option but it will do something close enough to what I was looking for.

 $(function(){
    var options_sel_idx = 0;

    $("#options").on("change", this, function(event) {
        if($(this.options[this.selectedIndex]).hasClass("disabled")) {
            alert("a");
            this.selectedIndex = options_sel_idx;
        } else {
            options_sel_idx = this.selectedIndex;
        }
    });
});

<style type="text/css">
    .disabled {color:#808080;}
</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select name="options" id="options">
  <option value="">Select</option>
  <option value="1">Options 1</option>
  <option value="0" class="disabled">Options 2</option>
  <option value="0" class="disabled">Options 3</option>
  <option value="0" class="disabled">Options 4</option>
</select>
Tyler Fontaine
  • 131
  • 2
  • 12