OK i am having one heck of a time. I have spent weeks looking for any accurate documentation on Magento2 modules. A few exist but they dont cover how i might get something as simple as the above code.
Feel free to point me to some seemingly obvious answer but i really need to have it wait till the entire DOM is loaded. This wouldnt be an issue but Magento2 seems to load JS files before HTML
No good. I have resolved to checking for an element to exist and if not aborting to call. The code just keeps getting called until the page does load. I wonder why Magento developers assume everyone understands their API. I wonder if posting meaningful documentation for single developer shops is being withheld to extort training fees?. To do anything in Magento 2 it seems you must resolve to reverse engineer. but this is a very incomplete tactic. Every other ecom and cms has extensive straight forward documentation. Why is it so hard to do the simple stuff