2016-01-19 85 views
-3

我在我的網頁上有2個div。我需要的是當按下提交按鈕時僅提交form_div。如何刷新提交按鈕點擊只div?

<div id="main"> 
<div id="form_div"> 
<form name="form"> 
<input type="submit" name="save" id="save"/> 
</form> 
</div> 
<div id="other_div"></div> 
</div>` 
+0

您可以檢查此鏈接:http://stackoverflow.com/questions/21646154/想要提交表格後提交 – soorapadman

+0

對於其他人的幫助,您需要展示您的努力 – soorapadman

回答

0

jQuery中,

你可以調用

$("your-custom-selector").click(function(){ 
//Do-whatever. This code only runs when your customselector is pressed. 
}); 

在JavaScript

document.getElementById("your-custom-selector").addEventListener("click", myFunction); 

function myFunction() { 
    //Do-whatever. This code only runs when your customselector is pressed. 
}