Liu Ou
Liu Ou

Reputation: 37

Show data gathered in a bootstrap toast

After storing some data I can't figure out how to make it show on a bootstrap toast

(javascript)

function getItemSuccess(data) {
    //4.3 Show the data in a Bootstrap Toast UI component
    $('.toast').toast('show')
    });

(html)

   <div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
        <div class="toast-header">
            <img src="..." class="rounded mr-2" alt="...">
            <strong class="mr-auto">DominantColor</strong>
            <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
        </div>
    </div>
    </div>

Upvotes: 0

Views: 121

Answers (1)

Dorian Mazur
Dorian Mazur

Reputation: 524

Try this:

   function getItemSuccess(data) {
        $('.toast strong').html(data);
        $('.toast').toast('show')
    });

Upvotes: 0

Related Questions