隐藏输入按钮 [英] Hide input button

查看:111
本文介绍了隐藏输入按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的代码: http://jsfiddle.net/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(); 

http://jsfiddle.net/TcFhy/


Here is the code I have: http://jsfiddle.net/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();

http://jsfiddle.net/TcFhy/

这篇关于隐藏输入按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆