Javascript Variable to Bootstrap Modal

前端 未结 4 887
误落风尘
误落风尘 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:47

    Bootstrap modal doesn't support this functionality. But you could write your own?

    function showModal(score){
      $('#myModal .score').html(score);
      $('#myModal').modal('show')
    }
    

    so clicking the calculate results what look something like this.

    $('#buttonCalcResults').click(function(){
      var score = foo+bar+whatever
      showModal(score);
    })
    

提交回复
热议问题