0

そのため、ユーザーが現在データベースにあるものを表示し、ボックスをクリックして編集できるようにするために使用したいページがあります。テキストの入力には機能するが、ドロップダウンボックスまたは日付セレクターでは完全に機能しないかなりハックな方法があります。私のHTML

   <td name='joineddate133'>
    <input type='date'
    id='joind133'
    name='joinda133
    value='2012-03-15'
    class='toedit'
    readonly='readonly'
    onclick='enablejoindate(this.id)'
    size='20'   />
    < /td>

現在のJavascript

<script>
function enablejoindate(joindatid){
    $(function(){ 
    $("input:text[id="+ joindatid +"]").removeAttr("class");
    $("input:text[id="+ joindatid +"]").removeAttr("readonly");
    $("input:text[id="+ joindatid +"]").addClass("inlineditjoind");
  });
  }
  </script>

inlinedit クラスはマーカーとして使用されるため、jquery はポストを簡単に見つけることができ、現在 toedit クラスは単に属性を非表示にしています。

明らかに、この解決策は素晴らしいものではなく、ダブルクリック機能などで入力を作成するためのより良い方法を試してみたいと思います.

4

4 に答える 4

1

DEMOをご覧くださいJSFiddle

JS/JQUERY -

$("#joind133").on('click',function(){
    $(this).removeProp("readonly")
        .removeClass("toedit")
        .addClass("inlineditjoind");
});

HTML -

<td name='joineddate133'>
    <input type='date' id='joind133' name='joinda133' value='2012-03-15' class='toedit' readonly='readonly' size='20'/>
</td>

IT ジェネリックバインディングを作成するためのリクエストに関する更新

$("input[type='date']").on('click',function(){
    $(this).removeProp("readonly")
        .removeClass("toedit")
        .addClass("inlineditjoind");
});
于 2013-09-30T09:49:39.770 に答える