lundi 6 août 2018

Laravel: Script onclick doesn't execute properly. Beginner

I am trying to assign a simple function to a button in a Laravel blade page. However, when I tried to click the button the function doesn't seem to execute. I am guessing there is a problem with the getElementById in Laravel.I am new to laravel please help me. Thank you

HTML

<button id="btn">Button</button>
<script>
document.getElementById('btn').onclick = function(){
  console.log('test')
}
</script>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire