点击按钮获取祖先标记

时间:2017-06-03 07:25:01

标签: javascript jquery html

当我点击后代按钮时,我想要表单标记。 当我点击另一个按钮时,只能抓住它的祖先表单标记。

jquery代码是什么?

**我的HTML代码在这里

<form class="edit">
  <div>
    <div></div>
  </div>
  <div>
    <div>
    <!-- When I click this button I want it's ancestor form tag only the edit form not the next or more-->
      <span><button>Click</button></span>
    </div>
  </div>
</form
<form class="edit">
  <div>
    <div></div>
  </div>
  <div>
    <div>
    <!-- When I click this button I want it's ancestor form tag only the edit form not the next, previous, or more..-->
      <span><button>Click</button></span>
    </div>
  </div>
</form

0 个答案:

没有答案