Search code examples
javascriptjqueryonblur

Submit shouldn't blur textarea with jQuery?


I have a textarea with a blur function:

$("#comment").blur(function() {
        ...something
    });

I don't want this blur() to happen when I click on the submit button below. How can I solve this?


Solution

  • Have you tried taking a look at When onblur occurs, how can I find out which element focus went *to*? -- it should help in this case so you can determine whether to fire the 'blur' function or not based on where the focus went to