简体   繁体   English

如何在 rest 按钮单击时 rest 动态文本框值

[英]how to rest dynamic text box value when rest button click

I want rest the value in the text box when the rest button click in dynamical created table.how do i do it?我想要 rest 在动态创建的表中单击 rest 按钮时文本框中的值。我该怎么做?

$table .='<tbody><tr>';
           $table .='<td>' . $row["emp_id"] . '</td>';
           $table .='<td>' . $row["emp_name"] . '</td>';
           $table .='<td>' . $row["date"] . '</td>';

           $table .='<td><input type="text" name="firstname" class="form-control" value="'.$row["ot_hour"] .'" size="4"></td>';
           $table .='<td><button type="button" name="ot_approval_rset" class="btn btn-primary btn-sm ot_approval_rset" " id="'.$row["emp_id"].'">Reset</button></td>';
           $currentMonth= date('Y-m');
           $query01 ="SELECT SEC_TO_TIME( SUM( TIME_TO_SEC( `ot_hour` ) ) ) AS timeSum 
           FROM otresquest
           WHERE emp_id ='".$row["emp_id"]."' AND date LIKE '$currentMonth%' AND overtime_status=6";
           $statement = $connect->prepare($query01);

           if($statement->execute())
           {  

            $result = $statement->fetchAll();
            foreach($result as $row){
               $table .='<td>' . $row["timeSum"] . '</td>';
               }   
            }

           $table .='</tr></tbody>';

java script code java 脚本代码

$(document).on('click', '.ot_approval_rset', function() {
    emp_id = $(this).attr('id');
    //i need write code here to reset (00:00:00) value of ot_approval_rset input box
  });

在此处输入图像描述 when click the reset button particular row ot hours should 00:00:00.单击重置按钮时,特定行的时间应为 00:00:00。

Let try this code让我们试试这段代码

 $(document).on('click', '.ot_approval_rset', function() {
        var otherInput = $(this).closest('tr').find('input').val('00:00:00');
      });

It may be help to you可能对你有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在单击按钮时保留先前的文本框值 - How to remain the previous text box value on button click 如何通过单击将按钮的值添加到文本框? - How can I add the value from button to the text box by click? <JSP/JQuery>单击按钮时如何制作文本输入框 - <JSP/JQuery> How to make text input box when click on the button 按钮上的Java单击可为文本框添加值 - Javascript on button click add value to text box Vue js单击按钮时动态添加文本框时绑定动态ID - Vue js Bind dynamic id when adding text box dynamically on button click css / js:如何在响应时单击按钮显示段落文本的其余部分? - css/ js: How to display on click on a button the rest of the paragraph text while being responsive? 在PHP中单击按钮时如何获取动态按钮值? - How to get dynamic buttons value when button is click in PHP? 如何在按钮单击上添加文本框? - How to add a text box on a button click? 如何从 html 获取文本字段值并将其传递给 REST GET 服务并在动态 HTML 表中显示响应 - How to get text field value from html and pass it to REST GET service and display the response in dynamic HTML table 我们如何在单击时将 Div 用作完整按钮将激活 rest 其他 div 将处于非活动状态 - How can we use Div as a complete button when click it would get active rest other div will be inactive
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM