0

我之前问过这个问题,但是在没有正确信息的情况下问了这个问题,又来了。我需要做的是取消按钮“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());
    });
4

2 回答 2

0

很难从你的问题中确切地弄清楚你想要做什么,但如果你想要的只是让文本输入恢复到它的占位符文本,只需将它的值设置为空白。

$("#activities_thoughts_1").val(''); 

这是一个例子http://jsfiddle.net/arG5f/

于 2013-01-18T00:58:41.970 回答
0

好吧,不太明白你想要什么,但这是我认为你想要的:

<!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>

在这里提琴

于 2013-01-18T01:07:35.277 回答