开发者

JQuery Mobile dialog fields clearing issue

I'm new to jquery mobile and need some assistance in solving an issue. I have four links in a jsp page implemented through jquery mobile framework. Each link on click opens different jquery modal dialogs. 开发者_Go百科Each link opens a new jsp in modal dialog. I have some common fields on all the dialogs and i used same ids for those fields in all the dialogs.

The issue is when i open a dialog and enter values and submits the form and comeback to parent page and again open a new dialog, the values of the common fields are showing up in the new dialog. I want to show a form with empty fields whenever i open the modal dialog. Pls help me on how to acheive this.


Sounds like you are using the same exact JSP for each modal view form.

2 options I see here:

  1. Clear the inputs on submit of the modal form

    $('#submit').click(function(){
        //Empty fields here
        $('#name').val('');
    });    
    
  2. Clear inputs on pageinit

    $('#modalForm').on('pageinit', function(){
        $('#name').val('');
    });
    
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜