Solution 1 :

If dropdownlist is in the masterpage, you need to store/update the value selected in language dropdown list in local/session storage in ‘onchange’ event of dropdown list e.g.

  $("#YourDropDownId").change(function () {
    localStorage.setItem("lang", [your_selected_language]);

next you can check when page loads if langis not null, set the dropdown list selected value:

$(document).ready(function() {
    if(localStorage.getItem("lang")) {
    //set dropdown selected value

hope this helps.

Solution 2 :

The issue is that there needs to be a binding of data in language drop-down and your backend. For example, in the session-storage or cookies for per-person who is browsing, you need to set a certain piece of code that tells what lanuage-selection the user has made and then for every page (in cookies, local-storage, session-storage) if that variable is found then the language is set to a certain one.

Better Approach:

For every user if there is a login info then that must be stored at backend and changes should be made (in a variable or something) so that every page gets the data for dropdown selection dynamically via variable rather than statically showing just the dropdown.

Your Issue:

Your issue is that the developer who was before, made different pages with a drop-down which he did not bind with a variable.

I still don’t know if he is embedding one single _partial html for dropdown on all pages or he has manually added the code for drop-down in all pages. If has made 1 single code for dropdown and including everywhere, your work will be easy. Otherwise you will have to make a variable and for every page based on it your will need to change the selection making 1 extra call to function or API per page.

Hope, this helps!

Problem :

I have recently joined a new company as a fresher front web developer (but, I already have a good knowledge in HTML5 and CSS3, also little knowledge in Javascript and Jquery as well). Immediately, I have been allocated to project that something I should work on chrome developer tool to fixing the bugs. But, last 10 days back, I really don’t have any idea about developer tool. But for now, I have learned myself through online about developer tool and I feeling better now, because I have fixed almost 40+ corrections which are mostly related to CSS3 and few Jquery.

The problem for me is someone has been developed this website via PHP they said. I don’t have any idea about how they developed this project, also not getting clear information. So, if i ask them a HTML file to add class or something, they said there is no separate HTML file for this project. So, i have decided to add class or remove class through jquery and CSS. I almost done, but I am unable to fix 3 more corrections which are purely related to JS and I don’t know how to find out these problems in chrome developer tool.

Bug no. 1: Apart from the “English” language in the drop-down list, if i select anyone example “french” it will landing to french page correctly but if i select “about-us” or any other navigation menus in the french page, it will landing to correct page but in the drop-down list saying “English” instead of “French” should be visible. I am attaching some of the screenshot over here. Can anyone help in this regard? I tried a lot of ways to fix it, but I was unable. I need a JS coding to solve this problem. can anyone,please? I will let you know afterwards regarding 2nd and 3rd corrections. I need this one, right now.screenshot.jpg

For your quick reference! Again, I have attached the clear view screenshot.Screenshot-two

please let me know if anything is required from my end, please.


Comment posted by GEkk

What do you mean by no separate HTML file? What I see, the server is not updating the

Comment posted by Abdul L

When I asking them for a HTML file to add a new classes for amendments, they said this project has been developed using PHP, CSS and Jquery for front end development. So, they were not able to show me a HTML file instead of index.php, header.php etc. I think they have used HTML coding in PHP, which is really not understandable for me as a fresh developer. Hope you understand! I am going to try now as per below answers. Thank you all!

Comment posted by Abdul L

Thank you, friend! I will try this coding and let you know. thank you once again.

Comment posted by Abdul L

Thank you for you detailed explanation, friend. This is going to so hard for me. Anyway, I will try and let you know. Thank you for your swift response!