0
I conducted a cursory research on enabling a select
when choosing an option in another select
, but I couldn’t find anything that applied.
$(document).ready(function() {
$('select#select1').select(function() {
$('select#select2').prop('disabled', false);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!doctype html>
<html>
<body>
<select id="select1">
<option>Opção 1</option>
<option>Opção 2</option>
<option>Opção 3</option>
</select>
<select id="select2" disabled>
<option>Opção 1</option>
<option>Opção 2</option>
<option>Opção 3</option>
</select>
</body>
</html>
You have two selects, being that the first one is like Disable, you want that by clicking on it the attribute Disable is removed?
– hugocsl
I do not believe that all events are disabled.
– Paulo Dos Santos
@hugocsl Yes! But I don’t think it’s going to work using some event in it.
– Paulo Dos Santos
I don’t really know if it’s possible, but you can have an "invisible" element over the select that when you click on it and select it you take the disabled.. But that would be gambiarra in my view, there must be a more correct way to do it
– hugocsl
That’s exactly what I did. I put a div with background-color: Transparent and z-index: 1; on it, and with jQuery I enabled select and removed the div with $('div#code'). remove(); by clicking on div. Plenty Ambi! Thanks again, @hugocsl.
– Paulo Dos Santos
@hugocsl I changed the question to something more doable.
– Paulo Dos Santos