JqueryNo Comments

default thumbnail

You can change the select options based on another select options by jquery easily

HTML

<select id="type">
<option value="">Training Mode</option>
<option value="Online Training">Online Training</option>
<option class="Class Room Training">Class Room Training</option>
</select>
<select id="size">
<option value="">Select Courses</option>
</select>

Jquery

$(document).ready(function() {
    $("#type").change(function() {
        var val = $(this).val();
        if (val == "Online Training") {
            $("#size").html("<option>Online Training Courses</option><option>Importance of technology in Real Estate</option><option>Taxation in Real Estate</option><option>Documentation in Real Estate</option><option>Legal in Real Estate</option><option>Effective use of social media in Real Estate</option><option>Lead Generation and Marketing</option><option>Sales training</option>");
        } else if (val == "Class Room Training") {
            $("#size").html("<option value='Course2'>Course2</option><option value='Course2'>Course1</option>");
}else if (val == "") {
            $("#size").html("<option value='Course'>Select Courses</option>");
}
    });
});

Be the first to post a comment.

Add a comment