Jquery取消按钮输入占位符文本
Jquery cancel button input placeholder text
我之前问过这个问题,但没有适当的信息,又来了。我需要发生的是取消按钮"list_btn_cancel"关闭弹出活动,并取代输入占位符输入的内容。这个表是输入。
<table width="100%" style="line-height:0px" >
<tr>
<td><p>1.</p></td>
<td><input name="activities_thoughts_1" id="activities_thoughts_1" type="text" style="width:345px;" placeholder="Type or click list button >" /></td>
<td><input type="button" id="thoughts_1" class="list_btn ext_thoughts" value="List >" /></td>
</tr>
</table>
**this table is the popup**
<div id="popup_activity" class="box_list">
<div id="list_question_btn"></div></div>
</div>
<div id="activity_area_content" style="padding-bottom:5px;" >
<form name="form1">
<table class="style2" width="100%">
<tr><br />
<td width="8%" align="right"><input name="thoughts_list" id="thoughts_list_0" class="thoughts_list" type="radio" value="It is just terrible that my child will not be a normal kid" /></td>
</table>
</form>
</div>
</div>
<div><table><td><a style="margin-left:290px" onclick="closeDialog('popup_activity');"><input type="button" id="thoughts_cancel" class="list_btn list_btn_cancel" value="Cancel >" placeholder="Type or click list button >" /></a></td> <td><a onclick="closeDialog('popup_activity');"><input style="margin-left:10px" type="button" id="close_thoughts" class="list_btn list_btn_close" value="Close >" /></a></td></table></div></div>
**Here is the script**
$('.list_btn').button();
$('#popup_activity').css("display","none");
$('#list_help').css("display","none");
$('.ext_thoughts').click(function(){
openDialog('popup_activity');
btn_id= $(this).attr('id');
});
$('.thoughts_list').click(function(){
( $(this).attr('id'));
$("#activities_" +btn_id).val($(this).val());
});
好吧,我不太明白你想要什么,但我认为你想要的是:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function()
{
$('.ext_thoughts').click(function(){
$("#popup_activity").toggle();
});
$('.list_btn_cancel').click(function(){
$("#popup_activity").hide();
$("#activities_thoughts_1").val('');
});
});
</script>
</head>
<body>
<input name="activities_thoughts_1" id="activities_thoughts_1" type="text" style="width:345px;" placeholder="Type or click list button " />
<br>
<input type="button" id="thoughts_1" class="list_btn ext_thoughts" value="Show/Hide List" />
<input type="button" id="thoughts_cancel" class="list_btn list_btn_cancel" value="Cancel" />
<br>
<div id="popup_activity" class="box_list" style="display:none;">
This is the pop up division
</div>
</body>
</html>
这里的小提琴
很难从你的问题中找出你到底想做什么,但是如果你想要的只是让文本输入恢复到占位符文本,只需将其值设置为空白。
$("#activities_thoughts_1").val('');
这里有一个例子http://jsfiddle.net/arG5f/
相关文章:
- 输入占位符文本转换CSS样式
- 谷歌翻译,输入类型='文本'中的占位符文本
- 函数来替换占位符文本
- 如何设置元素的占位符文本 我无法编辑 HTML 并且 ID 正在更改
- 初始化后更改输入字段的占位符文本
- 单选插件的占位符文本不起作用
- 在空输入字段中显示占位符文本
- 基于PHP if条件更改文本区域占位符文本
- 如何缓慢地遍历 jquery 循环,并每次替换占位符文本
- 获取占位符文本的父节点
- 版式中的占位符文本回退事件问题
- 以递归方式将占位符文本替换为变量的值
- 多选插件中的占位符文本不起作用
- 使用javascript将html占位符文本替换为html元素
- 忽略输入字段中占位符文本的PHP脚本
- 根据用户的选择更改占位符文本
- 使用jQuery交换输入字段占位符文本
- 如何在jQuery数据表上添加带有搜索图标的占位符文本
- 输入字段总是提示输入,而不是显示占位符文本
- 占位符文本在IE中不带项目符号.使用chrome可以很好地工作