나는 필드를 편집하고 싶은 html 파일을 가지고있다.자바 스크립트 오류 : ReferenceError : 편집이 정의되지 않았습니다. 편집 (this);
<script language="javascript" type="text/javascript" src="serialize-0.2.min.js">
function edit(element){
var tr = jQuery(element).parent().parent();
if(!tr.hasClass("editing")) {
tr.addClass("editing");
tr.find("DIV.td").each(function(){
if(!jQuery(this).hasClass("action")){
var value = jQuery(this).text();
jQuery(this).text("");
jQuery(this).append('<input type="text" value="'+value+'" />');
} else {
jQuery(this).find("BUTTON").text("save");
}
});
} else {
tr.removeClass("editing");
tr.find("DIV.td").each(function(){
if(!jQuery(this).hasClass("action")){
var value = jQuery(this).find("INPUT").val();
jQuery(this).text(value);
jQuery(this).find("INPUT").remove();
} else{ jQuery(this).find("BUTTON").text("edit");
}}); }
}</script>
아웃 내가 편집 버튼을 클릭하면, 그것은 참조 오류 편집을 보여주는 넣어 만드는 동안이 정의되지 않은 :
<body>
<div class= "table">
<div class = "thead">
<div class = "tr">
<div class = "td">ID</div>
<div class = "td">GROUP NAME</div>
<div class = "td">GROUP DESCRIPTION</div>
<div class = "td">IS ACTIVE</div>
<div class = "td"></div>
<div class = "td"></div>
</div>
</div>
<div class= "tbody">
<form class = "tr">
<div class = "td">1</div>
<div class = "td">hello</div>
<div class = "td">hwryou</div>
<div class = "td">y</div>
<div class = "td action" ><button type="button "onclick="edit(this);">edit</button> </div>
<form>
</div>
</div>
</body>
다음 내 자바 스크립트 코드입니다 : 다음 내 HTML 코드입니다 그게 뭐야?
업데이트 :
내가, (가) 저장 버튼을 클릭에 변경된 내용이 어디서 업데이트 쿼리를 작성해야 할 수 있습니다 database.How에 저장해야합니다 타 요구 사항이 있습니까? 또한 삭제 버튼을 클릭하면 업데이트 명령을 실행해야합니다./
여기에 공백이 없습니까? 'type = "버튼"onclick = "편집 (this);"? – elclanrs
실제 코드에는 없습니다. 공간이 있습니다. –