search

Home  >  Q&A  >  body text

javascript - input name is an array of variables, how to splice it?

$('input[name="cid[1]"]').val(data);//Assign display inventory code

This can be displayed normally, but it won't work if I modify the values ​​in the array into variables.

$('input[name="cid[$i]"]').val(data);//It cannot be displayed here

How to splice $i here?

PHPzPHPz2829 days ago655

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-05-27 17:44:39

    $('input[name="cid[' + $i + ']"]').val(data);

    reply
    0
  • Cancelreply