Created
October 26, 2012 09:40
-
-
Save allyraza/3957869 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- form --> | |
<form action="" method="post"> | |
<select name="os" id="selec-os"> | |
<option value="pc">PC</option> | |
<option value="mac">MAC</option> | |
</select> | |
<input type="text" name="os" id="os-field" /> | |
<input name="submit" type="submit" value="Submit" /> | |
</form> | |
<!-- javascript --> | |
<?php Yii::app()->clientScript->registerCoreScript("jquery"); ?> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$("#selec-os").change(function(){ | |
if($(this).val() === "mac") { | |
$("#os-field").attr("disabled", "disabled"); | |
} else { | |
$("#os-field").removeAttr('disabled'); | |
} | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment