Search code examples
javascriptjqueryhtmlmodal-dialogthymeleaf

thymeleaf - pass variable to modal


I open the modal like this:

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#upload">Upload</button>

I was wondering if there is a way to pass a thymeleaf variable to the modal.

I only found a question where Angular.js was used.

Thanks!


Solution

  • You may try to open modal dialog manually like this:

    $('button').click(function(){
        // Do your job
        $('#upload').modal('show');
    });