I have a Ruby on Rails Application, with application.html.erb
with the following body structure.
<Header>
<anchor tags></anchor tags>
</Header>
<%= yield %>
On clicking the anchor tags in the header -> the content of the yield changes. But the window.onload
only loads one time i.e. when the page loads for the first time, despite navigating through the anchor tags in the header. Due to which all the bindings and events which were handled inside the window.onload
are getting lost.
How to add the same bindings and events when window.load is not getting called OR any alternative to window.onload
using vanilla javascript that can solve the problem?