Hi Dave,
I think you should be attaching the event to the form submit. Also,
jQuery makes unobtrusive JavaScript really easy, so instead of
attaching a handler in the HTML, you can put it in a separate file.
Try something like this:
$(document).ready(function() {
$('#fname').submit(function() {
myfunc('param1','param2','param3');
return false;
});
});
Make sure you include jquery.js before your custom JavaScript file in
the <head>.
Hope that helps.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Apr 27, 2007, at 6:45 PM, Dave wrote:
I'm relatively new to javascript and REALLY appreciate the jQuery
library. Its made learning how to do thing much easier. That said,
I'm having a fit with an application I'm developing. I'm using Code
Igniter with jQuery and under Firefox 2 (OS X and Win) things work
great. IE however does not work. I mean the pages display fine, but
the instant a form is submitted it becomes obvious explorer isn't
working right. Basically I use the onClick event to call a function
in one of the js files:
<form id = "fname" method = "post>
<input ....>
<input type="submit" name="submit1" value="Find This"
onClick="myfunc('param1','param2','param3')">
Under Firefox this works great, and the "return false;" in the
function prevents the "submit" from firing. It does not work under IE
6. It simply submits nothing - the page reloads. OK fine, so I
change the submit button to this:
<input type="submit" name="submit1" value="Find This"
onClick="alert('Test');return false;">
Under FF and IE 6 this works! Alert box pops up and the form stops
loading.
So I try:
<input type="submit" name="submit1" value="Find This" onClick="$
('#fname').hide();return false;">
back to the old bad behavior. FF works fine - the form disappears,
under IE 6 no dice - the form just stares at me.
So it seems like the external javascript files are not loading? Or my
input syntax is off? I don't get any errors on the page. Also the
external css files load fine. I wish I could tell my customers - just
use FF but that won't fly.
TIA
Dave