Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript to update a div depending on selection from a dropdown?
    text
    copied!<p>I'm having a slight issue on one of our online system. We have a section where we give URLs for the user to give to their clients. The urls are inside a couple of DIVs, and there is a dropdown with language selections that updates the URLs inside the DIVs according to the language selected. The problem is, that this is working only in IE at the moment. Probably some bad coded javascript but I can't figure it out.</p> <p>This is the Javascript function</p> <pre><code>&lt;script language="JavaScript"&gt; function changedLanguage(langCode, divNames) { var i; for (i in divNames) document.getElementById(divNames[i]).innerText = document.getElementById(divNames[i]).value.replace('Language_Code=','Language_Code='+langCod e); } &lt;/script&gt; function changedTemplate(templateid, divNames) { var i; for (i in divNames) { if (templateid == '') { document.getElementById(divNames[i]).innerText = document.getElementById('f' + divNames[i]).value; } else { document.getElementById(divNames[i]).innerText = document.getElementById('f' + divNames[i]).value.replace('template_id=','Role='+templateid+'&amp;Registration=Y').replace('Registration.asp','PersonImport.asp'); }; }; } </code></pre> <p>This is the code on the dropdown</p> <pre><code>&lt;SELECT NAME="lstLanguage" id="lstLanguage"&gt; &lt;OPTION VALUE=""&gt;-- Generic default ---&lt;/OPTION&gt; &lt;OPTION ID="Arabic" VALUE="AR"&gt;Arabic&lt;/OPTION&gt; &lt;OPTION ID="German" VALUE="D"&gt;German&lt;/OPTION&gt; &lt;/SELECT&gt; </code></pre> <p>This is the second dropdown</p> <pre><code>&lt;select id="lstTemplate" name="lstTemplate"&gt; &lt;option value=""&gt;-- Generic default ---&lt;/option&gt; &lt;option value="4"&gt;Member&lt;/option&gt; &lt;option value="5"&gt;Student&lt;/option&gt; &lt;/select&gt; </code></pre> <p>The IDs of the DIV containers are </p> <p>'Ind_URL','Ind_W_URL','Login_URL','Login_W_URL','Group_URL','Group_W_URL','Group_Login_URL','Group_Login_W_URL','Holding_Login_URL','Holding_Login_W_URL','Pre_URL','Pre_W_URL'</p> <p>The first drop down needs to change the parameter on all DIVs, the second drop down needs to change the parameter on only the first two divs ('Ind_URL','Ind_W_URL').</p> <p>I tried using the jQuery code provided below but works perfect with one drop down, as soon as I change the selection on the second drop down it clears some of the divs and doesn't change the parameter.</p> <p>Any ideas?</p> <p>Thanks in advance</p> <p>Federico</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload