0

他の何かをクリックすると、最後の入力 (クリックされたもの) は readonly -> true になります。

ここに私のコードがあります:

<script>
  $(document).ready(function() {

   $("input").prop("readonly", true);      

   $("input").click(function() { 
        $(this).prop("readonly", false); 
    });

  });
</script>

ありがとう!

4

3 に答える 3

1

これを試して

--to make input editable on click
    $('input').bind('click', function () {
        $(this).prop("readonly", false);
    });

--to make input readonly on lost focus
    $('input').bind('blur', function () {
        $(this).prop("readonly", true);  
    });
于 2013-08-28T11:29:04.783 に答える
0
$("input").click(function() {
    var $that = $(this);
    $("input").each(function() {
       if ($(this) !== $that) {
          $(this).prop("readonly", false);
       }
    });    
});
于 2013-08-28T11:04:58.180 に答える
0

試す

$("input").attr("readonly", "readonly");
于 2013-08-28T11:05:38.347 に答える