开发者

JQuery Mobile dialog fields clearing issue

开发者 https://www.devze.com 2023-04-07 10:29 出处:网络
I\'m new to jquery mobile and need some assistance in solving an issue. I have fourlinks in a jsp page implemented through jquery mobile framework. Each link on click opens different jquery modal di

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

精彩评论

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

关注公众号