previewing php/jquery form in fancybox, then submit or return to form

后端 未结 2 1321
既然无缘
既然无缘 2020-12-22 03:29

I\'ve got a basic html/php form, with jquery validation. I want the user to be able to click a link that says \"preview\", have fancybox load up, and then I\'ll present a p

2条回答
  •  伪装坚强ぢ
    2020-12-22 03:56

    You can use Jquery, to get the values, and put them into the fancy box...

    A little like this...not quite, but you get the idea...

     $('#preview_button').click(function(){
    
    var msg = $('#recipient').val();
    var bg = $('input:radio[name=stationary_radio]:checked').val();
    
    $('h2#recipient').html(msg);
    //and whatever you wanna do with the value of the bg
    //probably apply some CSS on the fly to change the preview background?
    $('#fancybox').show();
    

    });

    The fancybox show() is likely wrong, never used fancybox, so I dont know, but Im just using a generic, 'hidden div' show. I assume fancybox has its own API that is different, so just substitute...

提交回复
热议问题