loading jquery twice causes an error?

Solution 1:

First to to answer your question, yes, including jQuery twice can cause all sorts of issues.

To fix it, this line:

document.write('<script type="text/javascript" src=""jquery-1.3.2.min.js""></script>');

Should be wrapped to check if jQuery already exists instead of blindly including it again, like this:

if (typeof jQuery == 'undefined') {  
  document.write('<script type="text/javascript" src=""jquery-1.3.2.min.js""></script>');
}

Then, it will only include it if jQuery isn't already on the page. There is one caveat, if you're using a different (probably newer) version of jQuery than the validation code was built for, there's a chance there are some breaks.

Solution 2:

Using an iframe will cause JQuery to load twice if you
1) load JQuery for each page (i.e. in Ruby on Rails via application.html.erb) and
2) the iframe is also a page from your application rather than an iframe of an external site.

Solution 3:

i spent hours figuring out why using jQuery.noConflict() doesn't work as is...

Just use var j$ = jQuery.noConflict(); and after that use j$ in place of $ every time you use Jquery on that page.