js初心者です。PHPAdminのようなエディタを作りたいです。テーブルをクリックすると、フィールドがテキストエリアに変わります。テキスト領域の外側のどこかをクリックすると、フィールドに戻り、SQL が実行されます。
以下は、私がjQueryで書くと思われるものです。それをさらにコーディングする方法がまったくわかりません。アドバイスをお願いします。
$('#editor #gird_edit').bind({
click: function() { //When Click
var content = $(this).text(); // read what is in the filed
$("#gird_edit").text('<textarea>'+a+'</textarea>'); // This is not work, will only add html code,not change to text-area
},
/* ??? */: function() { //Outside click of the text-area
var content = $(this).text(); // read what is in the text-area
$("#gird_edit").text(????); // change back to the filed
}
})
HTML
<div id='editor'>
<div id='gird_edit'>hallo world</div>
<div id='gird_edit'>hallo world 2</div>
<div id='gird_edit'>hallo world 3</div>
</div>
私は評判が 3 つしかないのですが、昨日参加したばかりです... 評判が 15 必要なため、投票できず申し訳ありません。しかし、私はあなたの助けに感謝します!!