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 6538833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:47:01+00:00 2026-05-25T10:47:01+00:00

From the jquery impromptu demo , for my purpose, I added a dropdown list

  • 0

From the jquery impromptu demo, for my purpose, I added a dropdown list to the popup form, but I am having problem figuring out how to have the “selected” value populated under the dropdown list in the modal form.

Take a look at my example, in the result box, notice that the first name on the list is ‘Mr John Doe’ and if you click on the ‘edit’ link, you will see that under the dropdown list, the title says ‘Mrs’. What i am hoping to achieve to have the right value populated in the dropdown list for ‘Title’ which in this case, it should say ‘Mr’.

Code:

function editUser(id){
    var user = $('#userid'+id)
    var fname = user.find('.fname').text();
    var lname = user.find('.lname').text();
    var title = user.find('.title').val();

    var txt = 'What would you like to change this to?'+
    '<div class="field"><label for="editfname">First Name</label><input type="text" id="editfname" name="editfname" value="'+ fname +'" /></div>'+
    '<div class="field"><label for="editlname">Last Name</label><input type="text" id="editlname" name="editlname" value="'+ lname +'" /></div>'+
    '<div class="field"><label for="edittitle">Title</label><select id="edittitle" name="edittitle" value="'+ title +'" /><option value="mrs" >Mrs</option><option value="mr" >Mr</option><option value="dr" >Dr.</option></select></div>';

...
}

HTML code:

<div id="userid1" class="user">
    <span class="controls">
         <a href="javascript:;" title="Edit User" class="edituser" onclick="editUser(1);">Edit</a>
    </span>
    <span class="fname">John</span>
    <span class="lname">Doe</span>
    <span class="title">Mr</span>
</div>

Hope I explained it well and appreciate any directions. thanks.

  • 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-05-25T10:47:02+00:00Added an answer on May 25, 2026 at 10:47 am

    Add the loaded option to $.prompt like so:

    loaded: function() { $("#edittitle").val(title); },
    

    Also use the following:

    var title = user.find('.title').text();
    

    Instead of what you currently have:

    var title = user.find('.title').val();
    

    And lastly make sure you are consistent with your Naming.
    For your option values make sure you use the same as the selected text. Don’t mix your cases! For example you want the following as your options:

    <option value="Mrs">Mrs</option><option value="Mr">Mr</option><option value="Dr">Dr</option>
    

    Make those changes and everything should work!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

see this demo from jquery ui you have to hold down the Ctrl key
I'm trying to insert reCaptcha code into my page from jQuery, but it doesn't
I'm creating multiple form retrieving data from jquery. after that i want to work
I want to add a background image from JQuery. I tried like everything but
just upgraded from jquery 1.4.2 to 1.4.4 and i've encountered a performance problem which
I currently use the rangeinput plugin from jQuery Tools in various places. But I
Im using the buttons from jQuery UI like this: (button).button(); Simple.. But when i
From jquery.validate.js, this regex is used to validate a number. The problem is that
I upgraded from JQuery 1.3 to 1.4.1, but now I get an exception: System.IO.FileNotFoundException
Apart from jQuery, which other JavaScript libraries support Visual Studio2005/2008 intellisense integration?

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.