how to submit a form loaded over bootstrap popover

后端 未结 1 780
粉色の甜心
粉色の甜心 2021-01-23 11:35

How can i submit a form using jquery, my form is loaded on the bootstrap popover. I tried the below jquery code but its NOT submitting the form

Ex. I have to submit be

相关标签:
1条回答
  • 2021-01-23 11:50

    Demo

    You need to move validate part out of from popover and put it onclick event like;

    $('.add_btn').popover({
        html: true,
         title: function () {
             formidd=$(this).parent().find('.projform_id').text();
            return $(this).parent().find('.sub_proj_head').html(); 
        }, 
        content: function() { 
            return $(this).parent().find('.sub_proj_content').html();
    
        }
    
    });
    
    $('.add_btn').click(function(e) {  
        $('.add_btn').not(this).popover('hide');
        e.stopPropagation();
        var formidd=$(this).parent().find('.projform_id').text();
        console.log(formidd)
        $("#"+formidd).validate({
                   rules: {
                       sproject_name: {
                           minlength: 3,
                           maxlength: 15,
                           required: true
                       }
                   },
                   submitHandler: function(form) {
                        alert("hi");
                        $(form).ajaxSubmit(); 
                    }
               });
    });
    

    And put submit button in your forms.

    0 讨论(0)
提交回复
热议问题