문제

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?

도움이 되었습니까?

해결책

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>

다른 팁

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).

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