enable/disable attributes

checkbox and a button attributes

by gricha2380

HTML

<form>
<p>
<select id="notificationtype">
<option value="emailonly"  onclick="enable_text(this.checked)" >Email Only</option>
<option value="textonly"  onclick="enable_text(this.checked)" >Text Message Only</option>
<option value="emailandtext"  onclick="enable_text(this.checked)" >Email and Text Message</option>
<option value="none" >None</option>
</select>    
    </p>
<input id="frequency" type="submit" value="Continue" />
</form>

CSS

html { margin: 9px; }

JavaScript

$(document).ready(function() {
    $('#notificationtype').change(function() {
        state = $(this).attr('value');
       if ($(this).val() == "none") {
                       $('#frequency').attr('disabled', 'disabled');
        } else if (state == '') {            $('#frequency').removeAttr('disabled');
        }
    });
});