I have a jsp and I create a spring checkbox like this:
<form:checkbox path="someList" value ="someId" onload = "javascript:alert(1);"/>
But the alert does not get called on page load. I am trying to call a javascript on load of the checkbox where i will execute some custom functionality.
Is there something wrong with the syntax?
This isn’t a spring-mvc question as much as html. The form:checkbox will translate to an html input tag of type checkbox. The html input tag does not support the onload attribute. For a full list of attributes refer to http://www.w3schools.com/tags/tag_input.asp. A recommended step would be to initialize everything required onload with the body tag.