Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8992835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:03:00+00:00 2026-06-15T23:03:00+00:00

I have a struts2-jquery drop down list where different data is available to select.

  • 0

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>) `

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:03:01+00:00Added an answer on June 15, 2026 at 11:03 pm

    You can use this.id

     var id = this.id; //using javascript, will give performance benefit.
     id = $(this).attr('id'); //using jQuery
    

    if you want to access other attribute of select e.g listKey

    listKey = $(this).attr('listKey');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form open in Struts2 jquery dialog box. When users submit this
i am unable to populate my Struts2 select drop down in my jsp page.
I have this error when I try to include the tag ( http://code.google.com/p/struts2-jquery/wiki/HeadTag )
I have the following code to do a doubleselect using Struts2 and the jquery
I am using jquery for UI , Struts2 as Action , JPA for Data
i have a jsp page with struts2 jquery grid. I want to show errors
I have this code just to send data from already loaded jqGrid: jQuery(#bedata).click(function(){ //Function
Edit Is there any other way I can fill the 2nd drop down as
What is the way to use a Struts2 select tag inside a Struts2 Jquery
My jquery is: $('select[name=select1]').change(function () { var cod=$(this).val(); if (cod>0) { $.ajax({ url:Load.do, data:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.