隐藏输入按钮

编程入门 行业动态 更新时间:2024-10-25 21:28:51
本文介绍了隐藏输入按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

以下是我的代码: 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">&nbsp;</span><span class="boxtitlebulk"><span class="boxtitletext">Folders</span><div style="float: right; margin-top: 4px;"><a href="#" onclick="javascript: AddFolder();"><div class="addplus">&nbsp;</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/

更多推荐

隐藏输入按钮

本文发布于:2023-08-01 18:43:18,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按钮

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!