【问题标题】:I need to Hide <tr> in a table when i click Addnew button(WORDPRESS,PHP)当我单击 Addnew 按钮(WORDPRESS,PHP)时,我需要在表中隐藏 <tr>
【发布时间】:2016-07-30 05:37:03
【问题描述】:
   Add new button

<div class="icon32 icon32-posts-post" id="icon-edit"><br></div>
    <h2><?php _e('Collaboration', 'custom_table_example')?> <a  class="add-new-h2" id=" add_new"
    href="<?php echo get_admin_url(get_current_blog_id(),   'admin.php?page=persons_form');?>"><?php _e('Add   new','custom_table_example')?> </a>
 </h2>

    (Need to hide) 
-----------------------------------------
 <tr class="form-field" id="appid">
    <th valign="top" scope="row">
        <label for="Application_ID"><?php _e('Application ID',  'custom_table_example')?></label>
    </th>
    <td>
  </tr>
 </tbody>
</table>

点击AddNew按钮时如何隐藏??
我不能直接给出隐藏或显示:无,因为“编辑和添加新”使用相同的表单。所以单击添加新我需要隐藏 tablerow
我还尝试过提供点击功能(Javascript)“document.getElementById("appid").style.display = 'none';"
我仍然没有得到任何回应。
有谁能帮帮我吗!!!提前感谢
参考这个链接wordpress-custom-database-table-example-full

【问题讨论】:

    标签: javascript php html wordpress


    【解决方案1】:

    尝试添加下面的javascript代码

    <script type="text/javascript">
      document.getElementById("add_new").addEventListener("click", function(event){
        document.getElementById("appid").style.display = 'none';
        event.preventDefault()
    });
    </script>
    

    【讨论】:

    • function myfunction() { Your code} '; ?>

      h2> 兄弟我试过这种方式页面它没有重新加载....!!!!!

    • 上面的代码不能正常工作@Ravindra Reddy
    猜你喜欢
    相关资源
    最近更新 更多
    热门标签