diff --git a/addons/survey/static/src/js/survey.js b/addons/survey/static/src/js/survey.js index f0096ddd3ee..d8c1d07f300 100644 --- a/addons/survey/static/src/js/survey.js +++ b/addons/survey/static/src/js/survey.js @@ -21,12 +21,11 @@ * the website engine. */ -$(document).ready(function () { - 'use strict'; - +(function () { +'use strict'; +openerp.website.if_dom_contains('.js_surveyform', function (the_form) { console.debug("[survey] Custom JS for survey is loading..."); - var the_form = $('.js_surveyform'); var prefill_controller = the_form.attr("data-prefill"); var validate_controller = the_form.attr("data-validate"); var submit_controller = the_form.attr("data-submit"); @@ -153,3 +152,4 @@ $(document).ready(function () { console.debug("[survey] Custom JS for survey loaded!"); }); +})(); diff --git a/addons/survey/static/src/js/survey_result.js b/addons/survey/static/src/js/survey_result.js index 6a7ccad1431..780345c736b 100644 --- a/addons/survey/static/src/js/survey_result.js +++ b/addons/survey/static/src/js/survey_result.js @@ -16,8 +16,9 @@ * along with this program. If not, see . */ -$(document).ready(function () { - 'use strict'; +(function () { +'use strict'; +openerp.website.if_dom_contains('.js_surveyresult', function () { console.debug("[survey] Survey Result JS is loading..."); //Script For Pagination @@ -174,4 +175,5 @@ $(document).ready(function () { }); console.debug("[survey] Survey Result JS loaded!"); -}); \ No newline at end of file +}); +})(); diff --git a/addons/survey/views/survey_result.xml b/addons/survey/views/survey_result.xml index 74742eb16c9..bc49f800832 100644 --- a/addons/survey/views/survey_result.xml +++ b/addons/survey/views/survey_result.xml @@ -13,7 +13,7 @@