基本上,我正试图展示隐藏的干.和联系,但有一些麻烦。 所需功能如下:
- On page load, DIV ID additional-languages is hidden
- User can click the Selected Additional Languages link which will show the additional-languages DIV
- At the point of clicking this link, the link will get hidden
- User can then choose to hide the additional-languages DIV by clicking on the hide link
- At the point of clicking this link, the Selected Additional Languages link will re-appear
在这方面,我迄今为止已经做了以下工作:
标记:
<div class="row">
<label for="native_language">Select</label>
<select name="native_language" id="native_language">
<option value="">Any</option>
<option value="1">English</option>
</select>
<a class="show-additional-link" href="#">Select Additional Languages</a>
</div>
<div id="additional-languages" style="display: none;">
<a class="hide-additional-link" href="#">[hide]</a>
<div class="row">
<!-- additional language checkboxes -->
</div>
</div>
JS:
$( .show-additional-link ).click(function(){
$(this).parent().next().slideDown();
$(this).hide();
return false;
});
The first part is working for me, but I m struggling on getting the second part to work, i.e. the functionality for the hide-additional-link . I have tried this:
$( .hide-additional-link ).click(function(){
$(this).parent().slideUp();
$(this).parent().prev( .show-additional-link ).show();
return false;
});
DIV是隐蔽的,但显示-附加联系没有显示。