jQuery input prob disable false by clicking the input -
i want clicking on input element, prop, "disabled" getting false, not working.
to set input on .ready "disabled" -> true working.
<script> $(document).ready(function() { $("input").prop("disabled", true); // working }); $("input").click(function() { $(this).prop("disabled", false); // not working }); </script>
solution / edit (sorry not allowed use answer-button on own question):
i found better solution. using "readonly" instead of "disabled" job.
<script> $(document).ready(function() { $("input").prop("readonly", true); $("input").click(function() { $(this).prop("readonly", false); }); }); </script>
seems logic reverted. disabled=true
means element disabled (not clickable). try way:
$(document).ready(function() { $(this).removeprop("disabled"); $("input").click(function() { $("input").prop("disabled", "disabled"); }); });
Comments
Post a Comment