문제

기본적으로 내가 원하는 것은 단순합니다. 사람들이 클릭 할 때 필드는 편집 가능합니다.

값을 변경 한 후 키보드에서 ESC를 누르거나 외부를 클릭하여 레코드를 저장하십시오.

왜 작동하지 않는지 잘 모르겠습니다. 문서화가 완료되지 않은 것 같습니다 ...이 작동 방식에 대한 아이디어가 있습니까? 문서 페이지 : http://www.appelsiini.net/projects/jeditable

여기에 기존 코드를 여기에 게시하여 사람들이 검토 할 수 있습니다.

testing.html

<head>

<title></title>

<script src="jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.jeditable.mini.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript" charset="utf-8">

$(function() {

  $(".click").editable("jeditabletest.php", { 
      indicator : "<img src='indicator.gif'>",
      tooltip   : "Click to edit...",
      style  : "inherit"
  });

});

</script>

<style type="text/css">
#sidebar {
  width: 0px;
}

#content {
  width: 770px;
}

.editable input[type=submit] {
  color: #F00;
  font-weight: bold;
}
.editable input[type=button] {
  color: #0F0;
  font-weight: bold;
}

</style>

</head>



<body>      
      <b class="click" style="display: inline">Click me if you dare!</b></> or maybe you should        

</body>
</html>


jeditabletest.php

<?php
echo "hehehe"
?>

누구든지 무엇이 잘못되었는지 아는 사람이 있습니까? 나는 여러 번 시도했지만 전혀 작동하지 않습니다. 모든 관련 라이브러리 파일이 이미 제출되었습니다.

도움이 되었습니까?

해결책

사용자가 외부를 클릭 할 때 양식을 제출하려면 다음을 수행합니다.

 $(".editable").editable("http://www.example.com/save.php", {
     onblur : "submit"
 }); 

ESC를 누를 때 제출하는 것은 일반적으로 ESC가 취소를 위해 보편적으로 예약되어 있기 때문에 나쁜 아이디어입니다. 정말로이 작업을 정말로 원한다면 Jeditable 코드를 편집해야합니다. jquery.jeditable.js에서 다음을 검색하고 편집하십시오.

/* discard changes if pressing esc */
input.keydown(function(e) {
    if (e.keyCode == 27) {
        e.preventDefault();
        reset.apply(form, [settings, self]);
    }
});

다른 팁

Yeap : 추천합니다 http://valums.com/edit-in-place/

사용합니다 div'에스 contentEditable 재산. 사용하기 전에 그것을 살펴 보는 것을 원할 수도 있습니다.

JRH

나는 당신의 코드를 실행했고 잘 작동하는 것 같았습니다. 그것이 당신을 위해 작동하지 않는 이유는이 .html 페이지가 웹 서버에서 실행해야하기 때문이라고 생각합니다. http : //localhost/mypage.html. Jeditable 플러그인은 편집 된 텍스트를 저장하려고 할 때마다 서버로 Ajax 호출을하고 Ajax 호출이 작동하려면 서버에서 페이지를 실행해야합니다.

도움이 되었기를 바랍니다!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top