<selectid="language"><optionvalue="en">english</option><optionvalue="fr">french</option><optionvalue="gr">german</option></select><scripttype="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><div><divid="related_en_content">
english text
</div><divid="related_fr_content">
french text
</div><divid="related_gr_content">
german text
</div></div><script>
$("#language").on("change", function() {
id = "related_" + $(this).val() + "_content";
$("#" + id).show().siblings().hide()
})
</script>
<selectid="language"onchange:"javascript:handle_language(this)"><optionvalue="en">english</option><optionvalue="fr">french</option><optionvalue="gr">german</option></select><script>functionhandle_language(what){
document.getElementById('related_en_content').style.visibility='hidden';
document.getElementById('related_fr_content').style.visibility='hidden';
document.getElementById('related_gr_content').style.visibility='hidden';
if(what.value=="en"){
document.getElementById('related_en_content').style.visibility='visible';
}
if(what.value=="fr"){
document.getElementById('related_fr_content').style.visibility='visible';
}
if(what.value=="gr"){
document.getElementById('related_gr_content').style.visibility='visible';
}
}
</script><divid="related_en_content">
english text
</div><divid="related_fr_content">
french text
</div><divid="related_gr_content">
german text
</div>
Post a Comment for "On Change The Select Value, Display Certain Div Content"