Jump to content

Adding extra lines of code into an HTML document


cve60069

Recommended Posts

Hello I want to dynamically add lines of code into an existing HTML document. I want to create a list of materials but the list is unknown. It could be two or five. I will create the list using Javascript and then insert the list into the HTML document. All of the code below the insertion will move down accordingly. I have seen it done using PHP but I want to do this in my browser. Should I be considering a jquery plugin as a method, similar to WOWslider?. Tutorials, advice or an example would be appreciated. Regards

Link to comment
Share on other sites

I would suggest asking this in the JavaScript forums. You can certainly accomplish this using JavaScript. One property I know of is .innerHTML. JavaScript is very nice about doing things dynamically. Judging by your general description of what you wish to accomplish, .innerHTML should do the trick.

Link to comment
Share on other sites

you could use innerHTML, or if you are rendering a list, it would make most sense to append <li> elements to an <ul> or <ol> element, that could already be on the page. But yes, you are correct in asserting that JS is needed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...