I'm trying to achieve to make the visibility of 1 select item dependent of another 1. I thought I could to this with javascript like this:
Head:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
jQuery(document).ready(function (){
jQuery("#filepermissiontype").change(function() {
if (jQuery(this).val() = "global") {
jQuery("#filepermissioncompanyid").hide();
}else{
jQuery("#filepermissioncompanyid").show();
}
});
});
</script>
Elements:
<select id="filepermissiontype" data-placeholder="..." name="filepermissiontype" class="select" value="<?php echo set_value('filepermissiontype'); ?>">
<option></option>
<option value="global">Everyone</option>
<option value="company">Company</option>
<option value="companyandchildren">Company & children</option>
</select>
<select id="filepermissioncompanyid" data-placeholder="..." name="filepermissioncompanyid" class="select" value="<?php echo set_value('filepermissioncompanyid'); ?>">
<option></option>
<option value="1">Corp 1</option>
<option value="2">Corp 2</option>
<option value="2">Corp 3</option>
</select>
With this, I expect that when I select global in the first select, the second select would disappear, but this is not happening. What am I doing wrong?
Thanks