breaststroke
Programmer
Hello,
I would like to know, please, if there is any reason why the following is not working (using the jQuery click function):
I am using a jquery API to make a post connection to a file in a third server (via the URL). I get the response (by details.response), which works fine, no problem at all with it.
The response (coming form an PHP script, in a third server, as i said) looks like:
So, when I get the response this is shown on an html file, by doing something like this (over a div element with ID=divwithbuttons):
This part works fine, no problem. The problem is with the click function meant to work on the button elements given (and shown), due to their particular ID's (with []);
I know it is because of the [], because tested without them it works fine.
This sort of use of ID's seems to work on Javascript, for instance on an onclick event (passed as a parameter), or on the document.getElementByID, etc...but, why not on a jQuery click function?? (I could try using the onclick event as well, to do what I want to do,but for some reason related to the application I am working on, is not working. It works without the application though).
Is there any reason for that or any way to fix it?? (I have tried different ways but with no avail).
I can provide with more details if it helps.
Thanks a lot in advance!
enjoy practicing languages at:
I would like to know, please, if there is any reason why the following is not working (using the jQuery click function):
JavaScript:
var i;
for(i=0; i<6;i++){
$("#button[i]").click(function(){
....
});
};
The response (coming form an PHP script, in a third server, as i said) looks like:
HTML:
<button id="button[1]"></button><br>
<button id="button[2]"></button><br>
....
JavaScript:
$("#divwithbuttons").html(details.response);
This part works fine, no problem. The problem is with the click function meant to work on the button elements given (and shown), due to their particular ID's (with []);
I know it is because of the [], because tested without them it works fine.
This sort of use of ID's seems to work on Javascript, for instance on an onclick event (passed as a parameter), or on the document.getElementByID, etc...but, why not on a jQuery click function?? (I could try using the onclick event as well, to do what I want to do,but for some reason related to the application I am working on, is not working. It works without the application though).
Is there any reason for that or any way to fix it?? (I have tried different ways but with no avail).
I can provide with more details if it helps.
Thanks a lot in advance!
enjoy practicing languages at: