Steve Tinsley
asked on
Array ID as Div ID
How do I use data from an array as the DIV ID? As you can see in my snipit code below, I am alerting to the screen the ID element of the array which works fine.
When I put that data in as the DIV ID it just prints out $rowData.id rather than (for example) 56.
Im sure its a simple one but I am stuck :(
Thanks
When I put that data in as the DIV ID it just prints out $rowData.id rather than (for example) 56.
Im sure its a simple one but I am stuck :(
Thanks
alert (rowData.id); //Displays Array ID
var htmlData = "<div class='rowData' id=$rowData.id style='display: none;'>";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I believe that you are using Dreamweaver's PHP code.
You are trying to add the id from the id of the database,right?
Please post a complete example for closer investigation and a better answer.
Good luck!
You are trying to add the id from the id of the database,right?
Please post a complete example for closer investigation and a better answer.
Good luck!
I may have misread the question but wouldn't the solution be as simple as adjusting the example code posted to the following (posted below).
Note that you would then take the contents of htmlData and add it to the html element of choice (via append, after, before, prepend etc)
Note that you would then take the contents of htmlData and add it to the html element of choice (via append, after, before, prepend etc)
alert (rowData.id); //Displays Array ID
var htmlData = "<div class='rowData' id='" + rowData.id + "' style='display: none;'>";
Open in new window