javajavascriptjqueryhtmlstruts-1

How can I put a placeholder in a struts textfield tag?


i got error because am using placeholder attribute in struts tags....

<html:text property="name" styleClass="form-control" placeholder="some text"/>

how can resolve the problem,pls help me.

Thanks in Advance.


Solution

  • Use jQuery attr like below:

    <html:text property="name" styleClass="form-control" styleId="abc" />
    

    JavaScript code:

    $(function() {
        $("#abc").attr("placeholder", "some text");
    });