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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:32:41+00:00 2026-06-02T17:32:41+00:00

Here is what i am trying to do: <select id=dynamic_select> <option value=http://blog.mysite.com/>United Kingdom</option> <option

  • 0

Here is what i am trying to do:

<select id="dynamic_select">
<option value="http://blog.mysite.com/">United Kingdom</option>
<option value="http://fr.blog.mysite.com/">France</option>
<option value="http://de.blog.mysite.com/">Deutschland</option>
<option value="http://it.blog.mysite.com/">Italia</option>
<option value="http://jp.blog.mysite.com/">日本</option>
<option value="http://es.blog.mysite.com/">España</option>
</select>

First Script

jQuery(function(){
  // bind change event to select
  jQuery('#dynamic_select').bind('change', function () {
      var url = jQuery(this).val(); // get selected value
      if (url) { // require a URL
          window.location = url; // redirect
      }
      return false;
  });
});

Another Script

jQuery(document).ready(function() {
 if(window.location.href.indexOf("fr") != -1) {
jQuery("#dynamic_select option[value='2']").attr('selected', 'selected');
}
});

This is a language selector which will be displayed on iphone (using WPtouchPro), the first part i.e. change of url based on selection is working perfect.. but i want to change the option selected in the drop down list with the value equal to the url of the page..
Also how to write those Japanese letter so that they display properly on all browsers..
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-06-02T17:32:45+00:00Added an answer on June 2, 2026 at 5:32 pm

    use UTF-8 charset for Japanese characters:

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>  
    

    by using data attribute you can try this:

    <select id="dynamic_select">
    <option data-c="uk" value="http://blog.mysite.com/">United Kingdom</option>
    <option data-c="fr" value="http://fr.blog.mysite.com/">France</option>
    <option data-c="de" value="http://de.blog.mysite.com/">Deutschland</option>
    <option data-c="it" value="http://it.blog.mysite.com/">Italia</option>
    <option data-c="jp" value="http://jp.blog.mysite.com/">日本</option>
    <option data-c="es" value="http://es.blog.mysite.com/">España</option>
    </select>
    

    supposing window.location.href.slice(7, 9) equals to de:

    $(document).ready(function() {
          lt = "de";
        $("#dynamic_select option").each(function(){
           if ($(this).data("c") == lt ) $(this).prop("selected", true);
        })
    });
    

    http://jsfiddle.net/qj8x8/1/

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

Sidebar

Related Questions

I am trying to follow this tutorial (http://railscasts.com/episodes/88-dynamic-select-menus) to get dynamic select boxes working
Here is a query I'm trying to write: SELECT I.*, IF(MAX(B.`amount`) != 0, MAX(B.`amount`),
Here's the query I'm trying to convert into Linq: SELECT R.Code, R.FlightNumber, S.[Date], S.Station,
Ok, so here is the code that I'm trying to execute. begin transaction; SELECT
I'm trying to select a value in a select element. I'm using Selenium RC
I'm using MySQL 5.1 Here's what I am trying to do: SELECT name, gender,
I am using directions from here: http://msdn.microsoft.com/en-us/library/ms257351(VS.80).aspx to create a managed event class. Here's
Hello guys i am trying attempt a dynamic select here. as soon as i
I'm trying to create an option to select a specific entry in a SQL
Beginner here trying to get a pipeline working in bash. If somebody can see

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.