GaGa Posted June 30, 2009 Share Posted June 30, 2009 I need help for jquery / Javascript , i have a silly question .If i want to use 2 or more plugins for Jquery everyone of them needs to be triggered through the <script> tag inside the <head> how can i do this add those scripts together and make them work ? (ofcourse after linking them )for example i`m using these Jquery form plugin & a twitter pluginthe form plugin needs to add this in the <head> <script type="text/javascript"> // wait for the DOM to be loaded $(document).ready(function() { // bind 'myForm' and provide a simple callback function $('#myForm').ajaxForm(function() { alert("Thank you for your comment!"); }); }); </script> and this for the twitter plugin <script type='text/javascript'> $(document).ready(function(){ $(".tweet").tweet({ username: "seaofclouds", join_text: "auto", avatar_size: 32, count: 3, auto_join_text_default: "we said,", auto_join_text_ed: "we", auto_join_text_ing: "we were", auto_join_text_reply: "we replied to", auto_join_text_url: "we were checking out", loading_text: "loading tweets..." }); });</script> and each one needs to add it`s script inside the <head> how can i do this ?i tried this <script type="text/javascript>form stuff</script><script type="text/javascript>twitter stuff</script> and this <script type="text/javascript> $(document).ready(function() { // bind 'myForm' and provide a simple callback function $('#myForm').ajaxForm(function() { alert("Thank you for your comment!"); }); $(".tweet").tweet( { username: "seaofclouds", join_text: "auto", avatar_size: 32, count: 3, auto_join_text_default: "we said,", auto_join_text_ed: "we", auto_join_text_ing: "we were", auto_join_text_reply: "we replied to", auto_join_text_url: "we were checking out", loading_text: "loading tweets..." });});</script> with no success i don`t know why ?thanks Link to comment Share on other sites More sharing options...
aspnetguy Posted June 30, 2009 Share Posted June 30, 2009 you need to include the scripts before calling them <script type="text/javascript" src="path/to/jquery.js"></script><script type="text/javascript" src="path/to/form_plugin.js"></script><script type="text/javascript" src="path/to/twitter_plugin.js"></script><script type="text/javascript"> $(document).ready(function() { // bind 'myForm' and provide a simple callback function $('#myForm').ajaxForm(function() { alert("Thank you for your comment!"); }); $(".tweet").tweet( { username: "seaofclouds", join_text: "auto", avatar_size: 32, count: 3, auto_join_text_default: "we said,", auto_join_text_ed: "we", auto_join_text_ing: "we were", auto_join_text_reply: "we replied to", auto_join_text_url: "we were checking out", loading_text: "loading tweets..." });});</script> Link to comment Share on other sites More sharing options...
GaGa Posted June 30, 2009 Author Share Posted June 30, 2009 yeah i know and i already linking them <link rel="stylesheet" type="text/css" media="screen" href="css/reset.css" /><link rel="stylesheet" type="text/css" media="screen" href="css/main.css" /><!--[if IE]><link rel="stylesheet" type="text/css" media="screen" href="css/ie.css" /><![endif]--><script type="text/javascript" src="scripts/jquery.min.js" /><script type="text/javascript" src="scripts/jquery.tweet.js" /> <script type="text/javascript" src="scripts/jquery.form.js" /><script type="text/javascript"> $(document).ready(function() { // bind 'myForm' and provide a simple callback function $('#myForm').ajaxForm(function() { alert("Thank you for your comment!"); }); $(".tweet").tweet( { username: "seaofclouds", join_text: "auto", avatar_size: 32, count: 3, auto_join_text_default: "we said,", auto_join_text_ed: "we", auto_join_text_ing: "we were", auto_join_text_reply: "we replied to", auto_join_text_url: "we were checking out", loading_text: "loading tweets..." });});</script> but i guess i found the problem i think cause i closed the script tags with /> instead of <script></script> Link to comment Share on other sites More sharing options...
aspnetguy Posted June 30, 2009 Share Posted June 30, 2009 yes you have to use <script></script> when linking to external files. Link to comment Share on other sites More sharing options...
GaGa Posted June 30, 2009 Author Share Posted June 30, 2009 thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.