I have a struts2-jquery drop down list where different data is available to select.
If users select any data, then am sending the select box value.
Now my new requirement is how can i send the id of the list instead of the value from the list.
Please check my below code and suggest me a good solution for my problem.
index.jsp:
<script type="text/javascript">
$(function(){
$("#selectthemeid").change(function(e){
var param = $(this).val();
alert(param); //this is giving me my selectbox value but i want the selectbox ID i.e (listKey="id")
});
});
</script>
<sj:select
name="theme" listKey="id"
listValue="themeName" id="selectthemeid" />`
Generated html output from my above struts2 selectbox
<select name="theme" id="selectthemeid" theme="jquery" keynav:shortcut="36">
<option value="68">black-tie</option>
<option value="69">blitzer</option>
<option value="70">cupertino</option>
<option value="71">dark-hive</option>
</select>
What i want is:
i want the id of my row i.e 68 (<option value="68">) currently from my above code i am getting the value of the select box i.e. black-tie (<option value="68">black-tie</option>) `
You can use this.id
if you want to access other attribute of select e.g
listKey