Karl Swedberg schrieb:
> Okay, so Mike and Blair got back to you before I could, but I'm going to
> answer anyway.
>
> They're right, of course, that you need to return false, because you
> want to stop the default action.
>
> One of the great things about jQuery is that it lets you easily separate
> behavior from content. So I would suggest pulling the onclick handler
> out of the input. Here is what it would look like with the script in the
> <head>, but ideally you should put it in another file and include it the
> same way you include jquery.js:
>
> <html>
> <head>
> <script src="scripts/jquery.js" type="text/javascript"></script>
> <script type="text/javascript" charset="utf-8">
> $(document).ready(function() {
> $('#submit-member').click(function() {
> var username = $(this).prev().val();
> $("#member_info").html(username);
> return false;
> });
>
> });
>
> </script>
All your solutions don't take into account that IE6 will still submit
the form if you hit enter - that was discussed a while back and here's
the test page for this:
http://stilbuero.de/demo/jquery/submit_test.html
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/