Php 使用子选择器进行查询

Php 使用子选择器进行查询,php,jquery,Php,Jquery,我有一个从PHP填充的div,我正在尝试将div中的所有输入框绑定到变量,(我不希望使用serialize)如何使用Jquery选择每个输入框并将其绑定到变量,例如 var location_id = $('#Wednesday').find('input').nth-child(0); var static_id =$('#Wednesday').find('input').nth-child(1); 这种性质的东西谢谢 <div id='Wednesday' class='ui-w

我有一个从PHP填充的div,我正在尝试将div中的所有输入框绑定到变量,(我不希望使用serialize)如何使用Jquery选择每个输入框并将其绑定到变量,例如

var location_id = $('#Wednesday').find('input').nth-child(0);
var static_id  =$('#Wednesday').find('input').nth-child(1);
这种性质的东西谢谢

<div id='Wednesday' class='ui-widget-content ui-state-default' name='' value=''>  ";

echo "<input name='".$day."_".$locationid."_locationID' value='".$locationid."'  type='hidden'> ";
echo "<input name='".$day."_".$locationid."_static' value='".$static."'  type='hidden'> ";
echo "<input name='".$day."_".$locationid."_primary' value='".$first_always."' type='hidden'> ";
echo "<input name='".$day."_".$locationid."_all_locations' value='".$all_locations."' type='hidden'> ";

</div>
”;
回声“;
回声“;
回声“;
回声“;

使用
.eq
而不是
.nth-child()
作为旁注(因为您已经有了答案),每当我看到类似于您的表单的输入名称时:

'name="' . $day . '_' . $location_id . '_locationID"'
我突然想到,在这种情况下,您可能应该使用数组样式的表单输入,如下所示:

'name="locationID[' . $day . '][' . $location_id . ']"'

这样,在PHP中,您已经在
$\u POST
中为您构建了一个很好的数组,您不需要
分解()
就可以从所有输入字段中构建数组。

这给了我[Object Object]作为返回值。@Edward您到底想要什么?关于
.eq(number).val()
'name="locationID[' . $day . '][' . $location_id . ']"'