how to change or replace class attr?

i have problem to display option class default selected when load page and to replace class default?
first i’m a newbie. this my code

function myView(sel) {
    $("#colomView").addClass(sel.value);

    };
.redBG{background-color:#ff0000;padding:10px;}
.blueBG{background-color:blue;padding:10px;}
<body>
<div id="colomView" class="">
<p>HERE DEFAULT TEXT</p>
<select onchange="myView(this);">
<option selected="selected" value="redBG">redBG</option>
<option value="blueBG">blueBG</option>
</select>
</div>
</body>

please help solve my problem? thanks


Source: jquery

Leave a Reply