Disabling specific option within Struts.html tag options tag

807 views Asked by At

I have a JSP wherein a dropdown option implements as:

<html:select property="ComplayDetail">
<html:options collection="companyList" name="companyAttribute" property="attribute" />
</html:select>

This drop-down option has values dynamically added like ABC,CDE, DEF,EfG.... Now i want to make an option i.e. DEF disable.

Can anyone help me to achieve this?

1

There are 1 answers

1
Ahmer Qureshi On

i think for jquery like :

$("#selectId > option").each(function() {

var currentvalue=$(this).val();

if(currentvalue == "DEF")
    {
       this.disabled=true;
    }

});