grlayouts Posted April 1, 2012 Share Posted April 1, 2012 Hi, I really need to find a way to print the code below in php. <script> $(document).ready(function() { $.sticky('The page has loaded!'); }); </script> i tried print"<script> $(document).ready(function() { $.sticky('The page has loaded!'); });"; </script> any help would be great. Quote Link to comment https://forums.phpfreaks.com/topic/260152-printing-a-script/ Share on other sites More sharing options...
btherl Posted April 1, 2012 Share Posted April 1, 2012 This should work: <?php print"<script> $(document).ready(function() { $.sticky('The page has loaded!'); }); </script>"; ?> Or you can just put the code outside php tags altogether. Also be careful of using "$" inside a print statemente - if you have $ followed by a letter it will be interpreted as a variable name and interpolated. Quote Link to comment https://forums.phpfreaks.com/topic/260152-printing-a-script/#findComment-1333390 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.