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

Hello guys, am new to odoo and would like a simple walkthrough on how I can write proper jquery to target web elements in a view, am using odoo 12. I am knowledgeable on how to write jQuery and have successfully included my js script from static/js/myscript.js. When I write my usual jQuery commands, nothing works, could anyone offer some help? I simply want to target all buttons with the class name "oe_stat_button" and give them a red background.

odoo.define('mubs.Sidebar', function(require) { 

 "use strict"; 

 var core = require('web.core'); 

 var session = require('web.session');    

var Widget = require('web.Widget'); 

 $(function() {     

(jQuery);    

$(".oe_stat_button").css("background", "red !important");        

 });

});



อวตาร
ละทิ้ง

Please post some more details what your are doing or post your code you are trying.

คำตอบที่ดีที่สุด
Hi Lordkrum,
Please refer the code given below,
odoo.define('mubs.Sidebar', function(require) {
"use strict";
var core = require('web.core');
var session = require('web.session');
var SystrayMenu = require('web.SystrayMenu');
var Widget = require('web.Widget');

var SideBar = Widget.extend({
    init: function (parent) {
        this._super.apply(this, arguments);
        $('.oe_stat_button').css('background-color', 'red');
    },
    });
return SideBar;
});
Hope this answer helps you,
Thanks & Regards

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 19
4358
0
ก.พ. 17
2846
0
มิ.ย. 22
2671
0
ก.พ. 22
2786
1
มี.ค. 19
5503