Form still posts back with return false in JS

Posted by jiewmeng on Stack Overflow See other posts from Stack Overflow or by jiewmeng
Published on 2010-05-31T14:38:08Z Indexed on 2010/05/31 14:42 UTC
Read the original article Hit count: 242

Filed under:
|
|

it seems like #frmToDo still posts backs

<form id="frmToDo" name="frmToDo">
    ...
    <a id="btnSubmit" href="javascript:document.frmToDo.submit();">Add</a>

google.load("jquery", 1);
google.load("jqueryui", 1);

google.setOnLoadCallback(function() {
    ...

    $("#frmToDo").submit(function() {
        return false;
...

why will this happen? might it be because of href="javascript:document.frmToDo.submit(). how can i submit the form with that link (i didnt use <input type="submit" /> because of styling problems, it seems like buttons are harder to style, esp in different browsers) the AJAX way?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery