html点击按钮显示弹出文本框

能否把详细代码告诉我,我做出反效果来了,

HTML+CSS:

<input type="button" class="check" />
<input type="text" class="text" style="display:none;" />

jQuery:

$(function(){
  $(".check").click(function(){
    $(".text").show();
  })
})

这个不行吗?这还不够详细啊?那还怎么详细?我总不能把你的网页都给你写了吧?再说我也不知道你的网页长什么样啊。

来自:求助得到的回答
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-08-04

1、使用jQuery显示出隐藏的文本框

$(function(){
    $("#按钮id").click(function(){//按钮绑定点击事件
        $("#文本框id").show();//文本框显示出来  注:之前设置display:none的样式
    });
});


2、使用jQuery新添加文本框

$(function(){
    $("#按钮id").click(function(){//按钮绑定点击事件
        var txt=$("<input type='text' id='txt1'></input>");//创建文本框对象
        $("#id").append(txt);//将对象添加至网页   $("#id")是文本框的上一级
    });
});

第2个回答  2015-12-09
见下方代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

<style>

p{ margin:0; padding:0;}

.login-put {

clear: both;

line-height: 36px;

margin-bottom: 20px;

overflow: hidden;

width: 500px;

}

.login-put label {

color: #8c8686;

float: left;

font-size: 14px;

height: 36px;

line-height: 36px;

text-align: right;

width: 120px;

}

#form1{ float:left; width:320px}

#form1 label {

float: left;

text-align: left;

width: 80px;

}

input {

cursor: pointer;

vertical-align: middle;

}

.login-put #div1 {

padding-left: 120px;

}

.login-put #div1 input {

border: 1px solid #dddddd;

color: #999999;

float: left;

height: 36px;

line-height: 36px;

margin-right: 10px;

padding: 0 5px;

width: 190px;

}

</style>

</head>

<body>

<div class="login-put"><label>推荐人:</label>

<form id="form1" name="form1" method="post" action="">

<p>

<label>

<script type="text/javascript">

function show()

{

var value = document.getElementById("div1").style.display;

if(value=="none")

{

document.getElementById("div1").style.display="block";

}

else

document.getElementById("div1").style.display="none";

}

</script>

<input type="radio" name="RadioGroup1" value="单选" onClick="show()"/>

<span class="recommend">有</span></label>

<label>

<input type="radio" name="RadioGroup1" value="单选" />

<span class="recommend">无</span></label>

<br />

</p>

</form>

<div id="div1" style="display:none"><input class="text01" name="" type="text" /></div>

</div>

</body>

</html>
相似回答