当我选择如下输入时,我想显示下一个 div,我该怎么做..
<div class="control-group">
<label class="control-label" for="domain">Do you have a <a href="https://www.google.com/search?q=what+is+domain+&oq=what+is+domain+&aqs=chrome.0.69i57j69i65j69i60l2j0l2.2204j0&sourceid=chrome&ie=UTF-8">domain</a> ? </label>
<div class="controls" name="domain">
<select id="select">
<option value="0">Pick one</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</div>
</div>
<!-- the name of the domain -->
<div class="control-group" style="display:none">
<label class="control-label" for="domain_name">Domain name ? </label>
<div class="controls" name="domain_name">
{{ Form::text('domain_name', null, array('required')) }}
<p class="help-block"><b>http://domain.com</b></p>
</div>
</div>
我用过的jquery
jQuery(document).ready(function($) {
// show the inputs that is hidden
$('#select').on('change', function(){
if($(this).val() == '1')
{
$(this).parent('.control-group').next('.control-group').show();
}
})
});