Javascript Variable to Bootstrap Modal

前端 未结 4 889
误落风尘
误落风尘 2020-12-11 23:53

Got what is probably a simple one, but my google is failing me at the moment so hoping i can get a bit of a push in the right direction

I have a HTML page that is ba

4条回答
  •  情歌与酒
    2020-12-12 00:44

    As Jahnux73 already said (or meant) that the modal will be in the same page, where you want it to appear. So in the function where you are calling an alert box you just have to call that modal.

     $('#yourModalId').modal('toggle');
    

    (or you can also use 'show' instead of toggle) And for the calculated values...you just need to add these values to the html of modal. So just get the element.

    output = document.getElementById('yourOutputTagId');
    

    and then you can set the properties of that output object; either you want innerHTML or value attribute (according to your design.)

    After setting all the required value you call your modal by the function mentioned above.

提交回复
热议问题