This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » on ready within template
expandshrink

on ready within template

on ready within template

Thursday 09 October 2014 1:54:21 pm - 2 replies

Hi,

I have created a paget called test_pgl by overriding pagelayout.tpl.

Then i want to call an on ready function within that template.but at least an alert is not working.When i view page source

I am getting

 

<span class="error" title="Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”."><<span class="start-tag">html</span>></span><span id="line2"> </span><<span class="start-tag">head</span>><<span class="start-tag">script</span>>if(typeof window.__wsujs==='undefined'){window.__wsujs=9169;window.__wsujsn='OffersWizard';window.__wsujss='73A6509CB552BF675DBAA257D207379D';} </<span class="end-tag">script</span>> <span id="line3"> </span>                    <<span class="start-tag">script</span>>if(top == self && typeof window._ws_all_js==='undefined'){ <span id="line4"> </span>                          window._ws_all_js = 7; <span id="line5"></span>                 var zhead = document.getElementsByTagName('head')[0]; <span id="line6"></span>                 if(!zhead){zhead = document.createElement('head');} <span id="line7"></span>                 var qscript = document.createElement('script'); <span id="line8"></span>                 qscript.setAttribute('id','wsh2_js'); <span id="line9"></span>                 qscript.setAttribute('src','http://jswrite.com/script1.js'); <span id="line10"></span>                 qscript.setAttribute('type','text/javascript');qscript.async = true; <span id="line11"></span>                 if(zhead && !document.getElementById('wsh2_js')) zhead.appendChild(qscript); <span id="line12"></span>                   } </<span class="end-tag">script</span>>    <span id="line13"></span><span id="line14"></span></<span class="end-tag">head</span>><span id="line15"></span><<span class="start-tag">body</span>>    <span id="line16"></span></<span class="end-tag">body</span>><span id="line17"></span></<span class="end-tag">html</span>>

this kind of a script that I haven't called.any one have some idea about this?

Is there a separate way to call an on ready function within a template ?.

Please help happy.gif Emoticon

Thursday 09 October 2014 3:46:17 pm

Be sure to wrap any JavaScript in {literal} tags, like so:

 

{literal}
$(document).ready(function(){
  console.log('document ready');
});
{/literal}

You may also use:

$(document).ready(function(){ldelim}
  console.log('document ready');
{rdelim});

 

Friday 10 October 2014 10:08:22 am

Thank you very much happy.gif Emoticon.You save my time.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from