Satu Sultana February 2016

Jquery not working every page if I write it in cakephp default ctp

In cakephp default layout page I have linked Jquery in Head tag. Before body tag in default.ctp I have added below code

<script>
  $(document).ready(function(){
     alert('hello');
  })
</script>

After click on left sidebar,It's working only in home page not in every page.Here I have create separate element for left sidebar.

Answers


Amit Soni February 2016

try

// A $( document ).ready() block.
$( document ).ready(function() {
    alert('hello');
});

Note:- Remove quotes with document object.


madalin ivascu February 2016

Place the script in the default layout page in the footer

Post Status

Asked in February 2016
Viewed 2,333 times
Voted 7
Answered 2 times

Search




Leave an answer