Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Jquery取消按钮输入占位符文本_Javascript_Jquery - Fatal编程技术网

Javascript Jquery取消按钮输入占位符文本

Javascript Jquery取消按钮输入占位符文本,javascript,jquery,Javascript,Jquery,我之前问过这个问题,但在没有适当信息的情况下问了这个问题,又问了一遍。我需要做的是取消按钮“list_btn_cancel”关闭弹出式活动,并用输入占位符替换输入内容。 此表是输入 <table width="100%" style="line-height:0px" > <tr> <td><p>1.</p></td> <td><in

我之前问过这个问题,但在没有适当信息的情况下问了这个问题,又问了一遍。我需要做的是取消按钮“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 &gt;" /></td>
            <td><input type="button" id="thoughts_1"  class="list_btn ext_thoughts" value="List &gt;" /></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 &gt;" placeholder="Type or click list button &gt;"  /></a></td>&nbsp;<td><a onclick="closeDialog('popup_activity');"><input style="margin-left:10px" type="button" id="close_thoughts"  class="list_btn list_btn_close" value="Close &gt;" /></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());
    });

一,

**此表是弹出窗口**
**这是剧本** $('.list_btn').button(); $('popup#u activity').css(“显示”、“无”); $('#list_help').css(“显示”、“无”); $('.ext_thinks')。单击(函数(){ openDialog(“弹出式活动”); btn_id=$(this.attr('id'); }); $('.thinks_list')。单击(函数(){ ($(this.attr('id')); $(“#activities_uu”+btn_id).val($(this.val()); });
很难从问题中准确判断出您想要做什么,但如果您只想让文本输入恢复为占位符文本,只需将其值设置为空白即可

$("#activities_thoughts_1").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>

$(函数()
{ 
$('.ext_thinks')。单击(函数(){
$(“#弹出#活动”).toggle();
});
$('.list_btn_cancel')。单击(函数(){
$(“#弹出#活动”).hide();
$(“#活动_思想_1”).val(“”);
}); 
});


这是弹出式分区

如果您已经发布了,那么您应该更新该问题,而不是制作新问题。你还没有说你试过什么/为什么不起作用。你试过什么?我真的不知道我在做什么,但我试着用占位符替换.val,这没有任何作用。试着减少你给基本要素的代码-很难看到你试图用50行代码来做。我现在有这个,它只是添加按钮值,而不是输入占位符$('.list_btn_cancel')。单击(function(){($(this.attr('id'));$(“#activities_'+btn_id).val($(this.val());});谢谢大家,我对任何类型的编程语言都还是很陌生的。这正是我需要的$('.list_btn_cancel')。单击(function(){$(“#popup_activity”).hide();$(“#activities_thinks_1”).val('');