Pergunta

I am using on my web page input array:

<input id='idInput[1]' />

And with some JavaScript function I am able to set the value of this input:

$('#idInput\[1\]').val(5);

Problem is that the ID of input which I want to set I have to send back to server (using AJAX) and after it send back the response, but because of backslash I need to add so many backslash because of AJAX processing, PHP processing and the end jQuery processing. So at the end it looks like:

ajaxSetIdWithResult("idInput\\\\\\\\[1\\\\\\\\]");

With this solution it is working well but I feel that is horrible. So can do it better?

Foi útil?

Solução

Try this:

instead #idInput[1] change id like below


<input id='idInput_1' />
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top