I want to always make only one input enable. To achieve that, I can disable inputs by adding disabled
attribute and remove that attribute on clicking by jQuery. Like this:
$('input').on('click', function(){
$(this).prop('disabled', false);
})
input, div{
width: 230px;
height: 20px;
padding: 0;
margin-top: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id="myform" method="GET" action="/mypath">
<input type="text" disabled ><br>
<input type="text" disabled ><br>
<input type="text" disabled >
</form>
Unfortunately nothing happens on click. What's wrong and how can I fix it?