I’ve came across this use case: Multiple template files have their own JavaScript code to handle browser resize. I wish that, as rendered result, all the templates will handle browser resize event using the JavaScript defined in each of the templates (Similar to the Event Handler feature of C#)
For example:
header.jsp - alert('foo') when browser resizes
body.jsp - alert('bar') when browser resizes
When header/body.jsp are rendered into one page:
alert('foo') then alert('bar') when browser resizes.
So far I don’t see how JQuery can support this use case. Is my idea feasible?
Thank you!
JavaScript is .js fileending and not .jsp.
But the event you must listen is the resize event. In JQuery you can use this:
or