Get html and scripts

Asked

Viewed 12 times

0

Has an options panel that changes constantly.
I display it in a sweetalert that way:

$(document).on('click','#acoes',function(){
    $.get('acoes.html', function(data) {
        Swal.fire({html: data});
    });
}); 

But in the archive acoes.html there are functions in the script tag that you would like to also load.

<script>
    $(document).on('click','#botao1',function(){
        console.log('CLICOU BOTAO 1')
    });
</script>

<div>
    <button type="button" id="botao1">BOTAO 1</button>
    <button type="button" id="botao2">BOTAO 2</button>
    <button type="button" id="botao3">BOTAO 3</button>
    <button type="button" id="botao4">BOTAO 4</button>
</div>

The html is loaded perfectly, showing the buttons of the second file.
The tag apparently carries too.
But the functions don’t work.

What to do to make it work?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.