![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi Guys, I have several .class DIVs I want to manipulate. I have retrieved them using the following code: * * * * var canvasClasses = new Array(); * * * * $(".canvas").each(function() { * * * * * * * * canvasClasses.push() * * * * }); I am now trying to insert some HTML into the DIVs but its not working: canvasClasses[0].innerHTML = "htmlhere"; Any ideas on why its not working ? |
#3
| |||
| |||
|
|
Hi Guys, I have several .class DIVs I want to manipulate. I have retrieved them using the following code: var canvasClasses = new Array(); $(".canvas").each(function() { canvasClasses.push() }); I am now trying to insert some HTML into the DIVs but its not working: canvasClasses[0].innerHTML = "htmlhere"; Any ideas on why its not working ? |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
You have to supply the canvas object as a parameter to the push function to add it to the array. canvasClasses.push($(this)); On Thu, Nov 5, 2009 at 10:16 AM, shaf <shaolinfin... (AT) gmail (DOT) com> wrote: Hi Guys, I have several .class DIVs I want to manipulate. I have retrieved them using the following code: * * * *var canvasClasses = new Array(); * * * *$(".canvas").each(function() { * * * * * * * *canvasClasses.push() * * * *}); I am now trying to insert some HTML into the DIVs but its not working: canvasClasses[0].innerHTML = "htmlhere"; Any ideas on why its not working ? |
#6
| |||
| |||
|
|
That doesnt work either. On Nov 4, 11:28*pm, Andrew Tan <afh... (AT) gmail (DOT) com> wrote: You have to supply the canvas object as a parameter to the push function to add it to the array. canvasClasses.push($(this)); On Thu, Nov 5, 2009 at 10:16 AM, shaf <shaolinfin... (AT) gmail (DOT) com> wrote: Hi Guys, I have several .class DIVs I want to manipulate. I have retrieved them using the following code: * * * *var canvasClasses = new Array(); * * * *$(".canvas").each(function() { * * * * * * * *canvasClasses.push() * * * *}); I am now trying to insert some HTML into the DIVs but its not working: canvasClasses[0].innerHTML = "htmlhere"; Any ideas on why its not working ? |
#7
| |||
| |||
|
|
If you used Andrew's example, then you added a jQuery object to the canvasClasses array. Calling innerHTML on a jQuery object won't work. Try canvasClasses[0].html('htmlhere') On Nov 4, 3:35*pm, shaf <shaolinfin... (AT) gmail (DOT) com> wrote: That doesnt work either. On Nov 4, 11:28*pm, Andrew Tan <afh... (AT) gmail (DOT) com> wrote: You have to supply the canvas object as a parameter to the push function to add it to the array. canvasClasses.push($(this)); On Thu, Nov 5, 2009 at 10:16 AM, shaf <shaolinfin... (AT) gmail (DOT) com> wrote: Hi Guys, I have several .class DIVs I want to manipulate. I have retrieved them using the following code: * * * *var canvasClasses = new Array(); * * * *$(".canvas").each(function() { * * * * * * * *canvasClasses.push() * * * *}); I am now trying to insert some HTML into the DIVs but its not working: canvasClasses[0].innerHTML = "htmlhere"; Any ideas on why its not working ? |
![]() |
| Thread Tools | |
| Display Modes | |
| |