Q&A

Running 2 functions in one liff button

How to running 2 fuctions in one liff button at same time.

like sendmessage and closewindows after.

cos html cant using to id's at one line.

  • 0
  • 1
  • 2002
  • twitter facebook

SOLVED. You just use another getelementbyclassname or insert functions at same getelementbyid.

ex liff.js function initializeApp(data) { // sendMessages call document.getElementById('sendmessagebutton').addEventListener('click', function () { liff.sendMessages([{ type: 'text', text: "Menu Mahasiswa" }]).then(function () { window.alert("Menu telah di buka silahkan tutup halaman web ini"); }).catch(function (error) { window.alert("Error sending message: " + error); }); liff.closeWindow(); }); document.getElementsByClassName('closewindowbutton').addEventListener('click', function () { liff.closeWindow(); }); }

index.html <button class="btn-google m-b-20" id="sendmessagebutton">Menu</button>

  • 0

Similar posts

    No similar posts

Are you sure? question.vm