Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以这就是我所拥有的:
<label for="prod1"> <p>aaa</p> </label> <label for="prod2"> <p>bbb</p> </label> <label for="prod3"> <p>ccc</p> </label> <label for="prod4"> <p>ddd</p> </label>
我正在向所有标签添加使用 JQ 的 href。我可以点击两个标签。如何获取被点击的标签链接并将其传递给 ajax ?
Jquery获取您单击标记的值
$(function () { $("#some").click(function () { var x = document.getElementById('some').innerText; var y = document.getElementById('some').value; alert(x); alert(y); }); });
页
<label id="some" for="prod1"> <p>aaa</p> </label>