我有一個正在上飛使用下方產生的PHP形式($theFeatures
是一個多維數組):選擇窗體數組值使用jQuery
<?php
foreach($theFeatures as $theKey => $theValues) {
?>
<input type="text" value="<?php echo $theValues['Key']; ?>" name="theFeatures[<?php echo $theKey; ?>]['Key']" size="6" />
<input type="text" value="<?php echo $theValues['Value']; ?>" name="theFeatures[<?php echo $theKey; ?>]['Value']" /> <br />
<?php
}
?>
這應該創建一個看起來像這樣的兩個輸入框:
<input value="Type" name="theFeatures[4]['Key']" size="6" type="text" />
<input value="Bird Table" name="theFeatures[4]['Value']" type="text" />
我怎樣才能在jQuery的(在上面的例子[4]
)陣列的第一部分,所以我可以存儲作爲一個JavaScript變量,並用它其他地方在我的jQuery?
乾杯,
安迪
這可能是最簡單的方法,而且避免了必須解析字符串。 – Peter 2010-01-15 17:06:21
或者你也可以使用rel =「」屬性。 – 2010-01-15 17:28:31
謝謝,親切。這是一個天才解決方案! – Schodemeiss 2010-01-19 09:07:01