Ayman Nedjmeddine Ayman Nedjmeddine - 1 year ago 83
Javascript Question

How to deal with DOM elements?

I am learning about writing custom JavaScript for my Odoo 10 addons.

I've written the following piece of code:

odoo.define('ioio.io', function(require) {
'use strict'

const e = $('div.o_sub_menu_footer')
console.log('--testing--'.repeat(7))
console.log(e)

// the "Powered by Odoo" down the secondary menu
e.remove()
})


The code is well loaded and I can see my testing string in the console.

However when this code is being loaded before the target
div
, so
e
empty/not yet filled and thus its content is not removed.

Doing it manually from the console works.

My question is what is the right way to do that? And how to know exactly when the code gets executed?

Answer Source

You can

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download