Changing input name attribute

Posted by Parhs on Stack Overflow See other posts from Stack Overflow or by Parhs
Published on 2010-04-10T12:07:56Z Indexed on 2010/04/10 12:23 UTC
Read the original article Hit count: 442

Filed under:
|
|

Hello! I have some hidden inputs like this

<input name="exam.normals[1].blahblah" ..../>

I would like somehow to replace the [1] with a number that I want (index).

I aint lazy but I am trying to find a good way to do this...

A solution would be a replace of exam.normals[1] with exam.normals[+ index +] but I should substr the whole string first.... With regexp I don’t know how to do the replace. good...

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery