jspstruts-1struts1

Setting tabindex on <html:select> Struts tag


I need to set a tabindex attribute on a html <select> dropdown menu that is generated with the<html:select> Struts JSP tag. However, it doesn't look like a tabindex attribute exists for this tag. Is there a way to somehow add it?


Solution

  • You can always use JavaScript or JQuery to bind certain attributes to your form elements which are rendered using some JSP tags that do not offer those attributes out of the box:

    $("#id1").attr('tabindex', '2'); 
    

    OR

    document.getElementsByTagName("id1")[0].setAttribute("tabindex", "2");
    

    Edit:

    I see your edit in the question. So your select tag is actually from struts tag library. This tag does offer tabindex attribute. See these struts docs.