I have a select which is dynamically populated with a short list of products and returns as a value the product name
Below this I have a
Finally I have this simple function which gets the name from the select value and then changes the corresponding div to a value of block.
$(document).ready(function(){
$("select").change(function(){
var name = document.getElementById('selectinterior'),
details = name.value;
document.getElementById(details).style.display = 'block';
})
});
It all works well except when another value is then selected the first div with the product details still shows. I need to have only one product detail div showing no matter how many times the user changes the select choice.