Custom Javascript onload

I have a tricky issue as I am using some custom javascript on the Quote builder tool where I am accessing the inputs to run some onchange events once the user changes something on the custom inputs. The code works great however it will only work once a quote has been initially saved. If you click create quote for whatever reason all of those inputs show up as null even though they have default values because for some reason the queryselector ID’s are not there when I try creating a quote and are only there after I save it. Any ideas?

We’d need to see your javascript to see why it doesn’t work. The javascript should wait until the fields are visible before proceeding with something like window.onload=function()

See this video which may help

Thought I was pretty clear based on the title of the topic however I am already using window.onload

window.onload = function(){

      num0 = document.querySelector('#typetotalamount00_c'),

num0.onchange = function() { 
 do something...


that is a quick example however something like this will lead to num0 being null because it doesn’t see the ID. however if you press the create button and create a quote then go back into it then it sees the ID…

Best Regards,