动态创建 div 时如何显示/隐藏 div
我正在开发具有两个级别的评论重播评论系统,我在如何显示和隐藏 div 方面遇到了问题 ..,因为它的 id 是不同的 ..,我尝试了一种方式:
I am developing comment systems with two level of replay to the comments and I have a problem with how to show and hide divs .., because it's id's are different .., I tried in a way with:
<button>replayl</button>
<span style="display:none;">
<form action='' method='post' name="addcmt" onsubmit="return validate()">
<textarea rows="1" cols="60" name='textarea1' id='textarea1' onKeyDown="limitText(this.form.textarea1,this.form.countdown,300);"
onKeyUp="limitText(this.form.textarea1,this.form.countdown,300);">
</textarea>
<br>
<br>
<input type="hidden" name="level1" id="level1" value="commtlevel1" />
<input id='addcmt' type='submit' value='Add reply' name='submit'/>
</form>
</span>
和jquery:
<script>
$("button").click(function () {
$("span").show();
});
</script>
但是这样当我点击回复按钮时,它会显示所有的 span 标签内容......,我想知道我如何只显示一个标签或一种完成工作的方式.
but this way when I click reply button it shows all the span tag contente.., I wanna kow how I show one tag only or a way to my work done.
推荐答案
编辑后的问题,我建议你使用 div
而不是 span
(因为 display inline vs block).
After edited question, i suggest you use div
instead of span
(because of display inline vs block).
$("button").click(function () {
$(".myform").toggle('slow');
});
可以按照您的意愿完成工作.这是结果.
would do the job how you want.Here is the result.
相关文章