jQuery传递值类 $(“.hidee2”)。单击(函数(){ 变量类型=$(“.st”).val(); } 房间状态:接受预订立即预订! 房间状态:接受预订立即预订! 房间状态:接受预订立即预订!

jQuery传递值类 $(“.hidee2”)。单击(函数(){ 变量类型=$(“.st”).val(); } 房间状态:接受预订立即预订! 房间状态:接受预订立即预订! 房间状态:接受预订立即预订!,jquery,Jquery,现在如何获取哪本书!链接用户单击?因为我需要传递st值?是否有任何方法可以使用jquery实现此目的?目前,仅传递st值 $(".hidee2").click(function() { var type = $(".st").val(); } <form action="" method="POST"><input type="hidden" class="st" value="st"><div class="button">Room Status

现在如何获取哪本书!链接用户单击?因为我需要传递st值?是否有任何方法可以使用jquery实现此目的?目前,仅传递st值

$(".hidee2").click(function() {
    var type = $(".st").val();
}

<form action="" method="POST"><input type="hidden" class="st" value="st"><div class="button">Room Status : Accepting Reservation <br /><span><span><a class="hidee2">Book Now!</a></span></span></div></form>

<form action="" method="POST"><input type="hidden" class="st" value="st2"><div class="button">Room Status : Accepting Reservation <br /><span><span><a class="hidee2">Book Now!</a></span></span></div></form>

<form action="" method="POST"><input type="hidden" class="st" value="st3"><div class="button">Room Status : Accepting Reservation <br /><span><span><a class="hidee2">Book Now!</a></span></span></div></form>
i、 例如,获取最近的表单,该表单是单击的锚点(它最近的祖先)的父级,然后从那里向下遍历以查找子输入,并获取其值

$(".hidee2").click(function() {
    var type = $(this).closest("form").find(".st").val();
});