-1
我想創建一個表,可以通過點擊它來修改它的內容,出現輸入框,如果它沒有對焦,它會再次回到一個文本(我在裏面做了一個跨度元素)jQuery Table Live Edit
$arr = array("fname", "lname", "company", "jobtitle", "category", "email", "phonenumber", "mobilenumber", "remarks");
foreach ($arr as &$value) {
echo "
$('.$value').click(function() {
$(this).replaceWith(function() {
return \"<span class='{$value}3'><input class='{$value}2' style = 'width:100%' name= '$value' value=\"+ \"'\"+$(this).text() + \"'\"+ \"/></span>\";
});
});
";
echo "
$('.{$value}2').blur(function() {
$('.{$value}3').replaceWith(function() {
return \"<span class='$value'>$value</span>\";
});
});
";
}
?>