Hello dalvi.nitesh2
I found a solution for your problem.
The task was the following: Users could choose a course from a dropdown-selection and the date of the course should be displayed beneath the selection in a seperate div
I solved it with two arrays:
1st array (kurse) has all the values from the the dropdown-list
2nd array (datum) has all the dates which I want to display
[select* course "course 1" "course 2"]
<div class="red box" id="datum">&nsbp; <!-- this div is for the date of the course //--> </div>
<script type="text/javascript" src="https://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
var datum=["17.03.2016", "11.04.-14.04.2016"];
var kurse=["course 1", "course2" ];
$(document).ready(function(){
$("select").change(function(){
$(this).find("option:selected").each(function(){
var a = kurse.indexOf($(this).attr("value"));
if($(this).attr("value")==kurse[a]){
document.getElementById("datum").innerHTML = "Datum des Kurses: " + datum[a];
$(".box").not(".red").hide();
$(".red").show();
}
else{
$(".box").hide();
}
});
}).change();
});
</script>
If you have questions, feel free to ask