load event in javascript/jquery library doesn't work - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: load event in javascript/jquery library doesn't work (/showthread.php?tid=39243) |
load event in javascript/jquery library doesn't work - El Forum - 03-05-2011 [eluser]Giorgio Nordo[/eluser] In my controller I would like to hide a div identified with the id #divpannello during the loading of every page. I used this code: Code: function __construct() where #dummy is an id for an image used in my view Code: <img id="dummy" src="<?php echo site_url(); ?>application/views/images/dummy.png" /> just for allowing the load (I'm quite new oto jquery and I am not sure this is the simple and correct way). The problem is that the jquery script seems work ONLY when I manually refresh the page. Obviously, I would like to automatically run the jquery script when I pass to any page without reloading it. Could someone help me insolving this trouble? Thanks in advance, Giorgio load event in javascript/jquery library doesn't work - El Forum - 03-05-2011 [eluser]steelaz[/eluser] I'm not a big fan of CI javascript library, so I can only suggest adding JS code in your view file. Here is how you hide an element with jQuery (first line loads jQuery from Google CDN): Code: <scr.ipt type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></scr.ipt> load event in javascript/jquery library doesn't work - El Forum - 03-05-2011 [eluser]Giorgio Nordo[/eluser] Thank you for your quick reply. As I told I am a newbie wicth JQuery and I preferred to use JavaScript library because a better compatibility but I'll follow your suggestion to avoid it and to embed directly the Jquery code in the view. Giorgio load event in javascript/jquery library doesn't work - El Forum - 03-05-2011 [eluser]InsiteFX[/eluser] It's does not have better compatibility to me it is overkill and I will not use it. For jQuery use it's no conflict. |