Currently on my project I have to trigger an ID whenever the window fully loads. So, to do that I have included jquery library and written the following script:
$(window).load(function(){
$('#parent_cat').trigger('change');
});
But I would like to know how can I achieve the same with just javascript as using the entire jQuery library for just few lines of codes is not ideal. I did search on the internet for how to trigger change event when window loads with the help of javascript but the solutions didn't help. So, if any one can help me out.
A solution that I tried:
document.getElementById("parent_cat").onchange();
But did not work. It shows an error document.getElementById(...).change is not a function.