Place HTML in Javascript
Posted May 9th 2012, 8:47pm
Hey dion,

I want ask and learn about javascript, first : How I can place HTML into Javascript? I believe using document.write() but if I want place the html after the <div id="main-content"> or replace the content in that class with my own html style

Second: I just want to replace my online list in my board with my own style! thanks ;)
φ
Posts: 12
Joined: May 2nd 2012, 9:58pm
Location: In Your Dream
Place HTML in Javascript
Posted May 10th 2012, 12:01am
To place HTML after <div id="main-content"></div> using javascript, use this:

$('#main-content).after('YOUR HTML GOES HERE');

Note that the above uses jQuery. To replace the content, use this:

document.getElementById('main-content').innerHTML='YOUR HTML GOES HERE';

There are many rules that you must follow in order for these to work. I suggest that you look at some of the resources listed in this topic:

viewtopic.php?t=1195
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Place HTML in Javascript
Posted May 10th 2012, 9:03pm
Wow nice, I learn lot from it! thx dion ;)
φ
Posts: 12
Joined: May 2nd 2012, 9:58pm
Location: In Your Dream

Who is online

Users browsing this forum: No registered users and 0 guests