我有一個html表單,人們可以在其中輸入購買項目的數量。該文本字段的默認值是1javascript或jQuery函數用於輸入字段之間的交互值
<input type="text" size="5" value="1" id="position" class="amntstyle" name="position">
我想其他文本輸入字段的價格在價值將是15位的時間自動。
例如,如果某人在位置字段中輸入3,則價格輸入字段將自動獲得值45。像這樣
<input type="text" size="5" value="45" id="price" class="amntstyle" name="price">
這可能嗎?
非常感謝您的幫助。
在我的Firebug控制檯中顯示錯誤。 (「#price」)。prop不是函數 但它在jsfiddle中有效。 – perception30 2012-08-16 07:13:18
對不起,我的jQuery版本是舊的! 它現在像一個魅力工作!非常感謝 – perception30 2012-08-16 07:20:04
@KhaledBinAQuadir所有好兄弟! ':''很高興幫助!是的,在較舊的verson中,您可以使用api'.attr'而不是'.prop',但我認爲它適合您! – 2012-08-16 08:53:13