Javascript 如何使用jquery在cakephp中检查哪个单选按钮?

Javascript 如何使用jquery在cakephp中检查哪个单选按钮?,javascript,jquery,cakephp-2.3,Javascript,Jquery,Cakephp 2.3,我有密码 $options = array('hours' => 'Hours', 'km' => 'Km', 'unit' =>"Unit"); $attributes = array('legend' => false); echo $this->Form->radio('unit_type', $options, $attributes); 现在我想检查哪个单选按钮在javascript中被选中。

我有密码

$options = array('hours' => 'Hours', 'km' => 'Km', 'unit' =>"Unit");
                            $attributes = array('legend' => false);
echo $this->Form->radio('unit_type', $options, $attributes);
现在我想检查哪个单选按钮在javascript中被选中。我曾经

$("input[name='data[Equipment][unit_type]']:checked").val();
但它不起作用。

试试这个


$(“输入[name='data[device][unit_type]'])。为(“:选中”)

请查看此链接@irfan我也尝试了上面的链接,但它不起作用。@Bina你能创建一个fiddle url吗?当我使用这个$(“输入:radio[id=myID]”)时,它起作用了。单击(function())解释和/或工作示例会很有帮助。