Search code examples
javascripthtmljspstruts-1

struts 1.1 - How to set the property of html:submit through JS


I have a form with a submit button in my Struts 1.1 JSP file:

<html:form ...>
    <html:submit onclick="onupload();"> 
        Upload
    </html:submit>
</html:form>

Now, I want to change the value of submit button in onupload() function. In regular HTML, I do it using document.getElementByName, but in html:submit tag the attribute name is not defined. So, I don't know how to change the value of button.


Solution

  • Use the styleName or styleId attributes to set the submit tag's name or id respectively.

    These attributes are documented in the taglib documentation.