开发者

How to shift focus in jquery?

I have a field and then a button in my form. I have some focus problem in mozilla. So, I decided to do it using focus evnet of jquery. $('.button-id').focus(); is not working for me. So, can i do this in jquery: As开发者_Python百科 some one writing in the input field and when hit enter keyword the focus shifts from input field to button.


If you give your input field type="submit", browsers should do this automatically.

Then, if you want your button to do something other than submit the form, you can handle the submit event:

$("#form-id").submit(function() {
    //do something
    return false; //don't submit
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜