Search code examples
javascriptstruts-1

Not able to invoke javascript function in html:text


I am using struts 1. I have a textbox like this

<html:text name="test" property="testProperty" size="10" onBlur="someJavascriptFunc()"  /> 

Its throwing an error while compiling

Attribute onBlur invalid for tag text according to TLD

How can I invole this javascript function?


Solution

  • Try this in your JavaScript Code

    var x = document.getElementsByName("test")[0];
    x.Attributes.Add("onBlur", "javascript:return someJavascriptFunc()");