我有以下代码:
- <select>
- <option value="Type 1">Type 1</option>
- <option value="Type 2">Type 2</option>
- <option value="Type 3">Type 3</option>
- <option value="Other">Other</option>
- </select>
- <input type="text" id="other" />
解决方法
这里不需要任何CSS.
- $('#sel').change(function() {
- var selected = $(this).val();
- if(selected == 'Other'){
- $('#other').show();
- }
- else{
- $('#other').hide();
- }
- });