表单或单击触发器提交

时间:2016-09-01 19:59:42

标签: javascript jquery

我目前有一个代码,动态加载,所以我不能调整它。 但现在我想在点击整个<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/url_path_swipe_procesbar" android:layout_width="match_parent" android:layout_height="wrap_content"> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.test.test1.UrlPageActivity"> <WebView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/url_page_web_view" /> </RelativeLayout> </android.support.v4.widget.SwipeRefreshLayout> 时触发提交。

我怎样才能实现?

我目前的代码:

<form>

1 个答案:

答案 0 :(得分:1)

好的,我会回答这个问题,但下次你需要发布你的javascript代码。

这是你的标记:

<!-- add a id here -->
<form id="form" action="http://example.com" method="post" target="_blank">

    <input type="hidden" name="token" value="1234567890">

    <input type="hidden" name="SESSID" value="1234567890">

    <input type="hidden" name="PHPID" value="1234567890">
    <!-- add a id here -->
    <input id="submit" type="submit" value="Open Panel">

    <p class="pakb-box-icon"><i class="icon-webadres"></i></p>

    <h2>Manage</h2>

    <p class="pakb-box-desc">TEXT</p>

    <p class="pakb-view-all">TEXT</p>

</form>

现在用你的标记设置是JS的时间:

<script type="text/javascript">
   //call a anonymous function
   $(document).ready(function(){
    //Event On click of the form
     $('#form').click(function(){

        $('#submit').trigger('click');

     })
   })

</script>

Obs:提交表格点击他的身体对我来说没有意义,请解释一下。

编辑:

您可以在www.codecademy.com上学习基本的JS和JQuery