0

I want to use a plugin to make most of my models inline editable, but I don't understand the following:

To use it, include jquery.rest_in_place.js in your template and execute the following in your document’s onLoad handler:

jQuery(".rest_in_place").rest_in_place();

http://jan.varwig.org/projects/rest-in-place

Where do I place this?

Satchel
  • 16,414
  • 23
  • 106
  • 192

2 Answers2

3

They likely mean the jQuery document ready event.

Inside your <head> section, place a $(document).ready(); like this.

<head>
    <script type="text/javascript">
        jQuery(document).ready(function() {
            jQuery(".rest_in_place").rest_in_place();
        });
    </script>
</head>

Or

<head>
      <script type="text/javascript">
          jQuery(function() {
               jQuery(".rest_in_place").rest_in_place();
          });
      </script>
</head>
Marko
  • 71,361
  • 28
  • 124
  • 158
0

The author probably meant the jQuery ready handler which gets executed when the DOM (hierarchical structure of the document) is fully loaded.

Your JavaScript code should look as follows

$(document).ready(function() {
    $(".rest_in_place").rest_in_place();
});

Note that $ is a synonym for jQuery (unless you explicitly enable the compatibility mode).

Adam Byrtek
  • 12,011
  • 2
  • 32
  • 32