Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
777 มุมมอง

here in odoo 13 I create a website template. inside this template i added a button. now I want to show a message after clicking this button through js. but in my code its not working please help me regarding this issue. 

js code:

odoo.define('spiralworld_agm_webinar.zoom_button', function (require) {
"use strict";

// Wait for the document to be fully loaded
$(document).ready(function () {
// Find the "Join Meeting" button by its ID
var joinMeetingButton = document.getElementById('joinMeetingButton');

if (joinMeetingButton) {
// Add a click event handler to the button
joinMeetingButton.addEventListener('click', function () {
// Display a message in the console
console.log("Button clicked - Join Meeting event handled.");
// You can add more code here to perform additional actions
});
}
});

});


I added this js inside website.asstets_frontend



อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,


Ensure that your JavaScript file is included correctly in your website template.


<template id="template_id" name="template_name" inherit_id="website.assets_frontend">

            <xpath expr="." position="inside">

                <script type="text/javascript" src="js_file_path"/>

            </xpath>

</template>




Hope it helps

อวตาร
ละทิ้ง