Afficher/masquer (activer / désactiver) l'affichage de vrd basé sur la sélection à l'aide de javascript

J'ai une page web avec un menu déroulant et deux divs comme indiqué ci-dessous:

<html>
<head>
<title>Show/Hide a div section based on selection</title>
</head>
<body>
    <select id='sel'>
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
    </select>

    <div id="firstdiv">
    <label><input type="checkbox" id='1' />A</label>
    <label><input type="checkbox" id='2' />B</label>
    <label><input type="checkbox" id='3' />C</label>
    </div>

    <div id="seconddiv">
    <label><input type="checkbox" id='4' />D</label>
    <label><input type="checkbox" id='5' />E</label>
    <label><input type="checkbox" id='6' />F</label>
    </div>
</body>
</html>

Comment puis-je activer /désactiver l'affichage de ces deux divs basé sur la sélection à l'aide de javascript ou jQuery? I. e. lorsque je choisis l'option 1, le firstdiv doit s'afficher et que plus tard, on devrait se cacher et vice versa.

InformationsquelleAutor mpsbhat | 2013-10-21