以下是我的代码: jsfiddle/Draven/rEPXM/23/
我想知道如何隐藏添加提交按钮,直到我点击 + kbd> image将输入框添加到表单中。
我不想在输入框旁边添加提交按钮,因为我希望能够添加多个输入框并在点击添加时提交。 $ b HTML $ b
< div id =left> < div class =box> < div class =boxtitle>< span class =boxtitleleftgap>& nbsp;< / span>< span class =boxtitlebulk>< span class =boxtitletext >文件夹< / span>< div style =float:right; margin-top:4px;>< a href =#onclick =javascript:AddFolder();>< div类= addplus >&安培; NBSP;< / DIV>< / A>< / DIV>< /跨度>< / DIV> < div class =boxcontent> < form method =postid =folderformaction =page.php?action = list-volunteer-appsname =folderform> < / a>< a class =evenhref =page.php?action = list-volunteer-apps& folder = 1>文件夹1< span class =text>( 0)< /跨度>< / A> < div id =foldercontainer>< input type =submitvalue =Add>< / div> < / form> < / div> < / div> < / div>jQuery 函数AddFolder(){ $('#foldercontainer')。append('< input name =folder []type =textsize =20 />'); }
解决方案
ID,并使其开始隐藏
< input type =submitid =addButtonvalue =Addstyle =display:none;>然后使用 show() jQuery方法:
$(#addButton)。show();jsfiddle/TcFhy/
Here is the code I have: jsfiddle/Draven/rEPXM/23/
I'd like to know how I can hide that Add submit button until I click the + image to add input boxes to the form.
I don't want to add the submit button next to the input box because I want to be able to add multiple input boxes and submit them all when I click Add.
HTML
<div id="left"> <div class="box"> <div class="boxtitle"><span class="boxtitleleftgap"> </span><span class="boxtitlebulk"><span class="boxtitletext">Folders</span><div style="float: right; margin-top: 4px;"><a href="#" onclick="javascript: AddFolder();"><div class="addplus"> </div></a></div></span></div> <div class="boxcontent"> <form method="post" id="folderform" action="page.php?action=list-volunteer-apps" name="folderform"> <a class="even" href="page.php?action=list-volunteer-apps&folder=2">Folder 2 <span class="text">(1)</span></a><a class="even" href="page.php?action=list-volunteer-apps&folder=1">Folder 1 <span class="text">(0)</span></a> <div id="foldercontainer"><input type="submit" value="Add"></div> </form> </div> </div> </div>jQuery
function AddFolder() { $('#foldercontainer').append('<input name="folder[]" type="text" size="20" />'); }解决方案
Just give the button an ID, and make it start hidden
<input type="submit" id="addButton" value="Add" style="display: none;">Then use the show() jQuery method:
$("#addButton").show();jsfiddle/TcFhy/
更多推荐
隐藏输入按钮
发布评论