Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jQuery禁用多个表单之一中的按钮_Jquery - Fatal编程技术网

使用jQuery禁用多个表单之一中的按钮

使用jQuery禁用多个表单之一中的按钮,jquery,Jquery,我有很多这样的表格: <form class="some-name"> <input type="hidden" name="bill" value"flower" /> <button value="0">Yes</button> <button value="1">No</button> <button value="2">No</button> </form

我有很多这样的表格:

<form class="some-name">
    <input type="hidden" name="bill" value"flower" />
    <button value="0">Yes</button>
    <button value="1">No</button>
    <button value="2">No</button>
</form>

<form class="some-name">
    <input type="hidden" name="ben" value"men" />
    <button value="0">Yes</button>
    <button value="1">No</button>
    <button value="2">No</button>
</form>
还尝试:

$(document).on("click", ".some-name button", function(){
    $($(this)).parent("button").attr("disabled", true);
});
但两个都不走运

$(document).on("click", ".some-name button", function(){
    $(this) // currently clicked button
      .siblings("button")  // all neighbor of clicked button
      .prop("disabled", true);  // set disabled
});
相关参考文献:

相关参考文献:

这不是有效的jQuery。你想要的是:

$(this).parent().find('button')
这不是有效的jQuery。你想要的是:

$(this).parent().find('button')
试试这个:

$(document).on("click", ".some-name button", function(){
     $(this).parent('form').children("button").attr("disabled", true);
});​
以下是您的建议尝试一下:

$(document).on("click", ".some-name button", function(){
     $(this).parent('form').children("button").attr("disabled", true);
});​

这是

为什么你有$$this???@Christopherkeney在编辑时把括号弄乱了为什么你有$$this???@Christopherkeney在编辑时把括号弄乱了