Old 29-06-2009, 07:05   #1 (permalink)
GaGa
Registered User
 
Join Date: Apr 2009
Posts: 4
Javascript / Jquery amateur help ?

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 plugin
the form plugin needs to add this in the <head>
Code:
<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

Code:
<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 ?

thanks
  Reply With Quote
Old 29-06-2009, 07:10   #2 (permalink)
doodleflip
Senior Member
 
doodleflip's Avatar
 
Join Date: Jan 2009
Posts: 459
You literally just put them both inside the <head> tag. Providing neither of them have any conflicts (maybe something being named the same in each plugin) it should work fine.

So its:

Code:
<script type="text/javascript> form stuff </script> <script type="text/javascript> twitter stuff </script>
  Reply With Quote
Old 29-06-2009, 07:20   #3 (permalink)
Shiro
Whitey
 
Shiro's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 7,323
Code:
<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>
__________________
This space for rent.

After Hours Japan
  Reply With Quote
Old 29-06-2009, 07:38   #4 (permalink)
GaGa
Registered User
 
Join Date: Apr 2009
Posts: 4
I don`t know but it`s not working ? this how it looks now

this is shiro way
Code:
<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>

and this is like doodleflip said
Code:
<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"> // 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> <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>

did i made any mistakes ?
  Reply With Quote
Old 29-06-2009, 07:52   #5 (permalink)
Paul
shifting...
 
Paul's Avatar
 
Join Date: Oct 2006
Location: location, location
Posts: 1,996
seems fine, listen to shiro's way. got a link?
  Reply With Quote
Old 29-06-2009, 08:11   #6 (permalink)
GaGa
Registered User
 
Join Date: Apr 2009
Posts: 4
no i don`t have a link , but do u think is stopping it from working ? cause everyone is working separately !
  Reply With Quote
Old 29-06-2009, 08:12   #7 (permalink)
funkyprem
For all your goober needs
 
funkyprem's Avatar
 
Join Date: Dec 2004
Location: Coventry, UK
Posts: 1,823
do the links to the files actually pull up the files?
__________________
The human race is faced with a cruel choice: work or daytime television.

prem ghinde
  Reply With Quote
Old 29-06-2009, 08:30   #8 (permalink)
GaGa
Registered User
 
Join Date: Apr 2009
Posts: 4
ofcourse cause they are working when i just add one of the scripts in the <head> but not working when i add both
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive
Web Hosting by Heart Internet, vBulletin © 2000-2009 Jelsoft Enterprises Limited.
Search Engine Optimization by vBSEO 3.0.0 RC8
Web Hosting by Heart Internet