HTML のフォームがあり、javascript を使用してフィールドから最大数を抽出したいと考えています。例えば:
<input id="temp_0__Amount" name="temp[0].Amount" type="text" value="lorum ipsum">
<input id="temp_1__Amount" name="temp[1].Amount" type="text" value="lorum ipsum">
<input id="temp_2__Amount" name="temp[2].Amount" type="text" value="lorum ipsum">
この場合、javascript で 2 を生成する必要があります。
私はjQueryで何かを試していましたが、それ以上はできません:
$('input[name^="temp"]').last().name;
これにより、 が生成されtemp[2].Amount
ます。しかし、私は2を抽出したいだけです。文全体ではありません。そして、部分文字列のようなものを使用できることは知っていますが、「クリーンな」方法があるかどうか疑問に思いました。