views:

633

answers:

2

I just started with Jeditable and for 3 hours now it seems I can't figure it out. This tutorial should have been piece of cake:

http://www.appelsiini.net/projects/jeditable

, but it turned out to be a little pain in the a$$. I've put the jquery.js and jquery.jeditable.js in the same directory with the main page. This is my code (it seems like the code tags won't do the trick, so I'll give you only the important blocks): the header contains

     <script type="text/JavaScript"
  src="jquery.js"></script>
 <script type="text/JavaScript"
  src="jquery.jeditable.js"></script>
 <script type="text/JavaScript"
  $(document).ready(function() {
   $('.edit').editable('#');
  });

and the body of my html contains:

<div class="edit" id="div_1">Edit me</div>

And that's about it. It should give me an editable form when I click the "Edit me", but nothing happens. Where do I go wrong ? Thanks in advance.

A: 

Are you trying to send the ajax to the same page you are on? If so, replace the '#' with window.location.href and you should be good to go.

psayre23
+2  A: 

I don't know if this is a typo in the question or your actual code but check this line:

<script type="text/JavaScript"
 $(document).ready(function() {
  $('.edit').editable('#');
 });

it should be

<script type="text/JavaScript">
 $(document).ready(function() {
  $('.edit').editable('#');
 });
</script>
Vincent Ramdhanie
Thanks. You where right. It turned out I missed a closing bracket for the 'script' tag. I'll try to be pay more attention in the future. Once again, thanks alot.
Progenitura
As a hint when developing JS you should use tools such as FireBug. They warn you when you have an error or typo (as you had) in your code. FireBug is a real timesaver
Mika Tuupola