0

Hiya!

I'm working on converting an HTML document (AmCharts Pie) to all JavaScript for work, and I ran into a bit of a bump. (NOTE: I'm not a Javascript programmer)

Okie - my question is this: Is there a JavaScript equivalent to the HTML Div tag? Here's a piece of the code:

<head>
    <script src="../amcharts.js" type="text/javascript"></script>        
</head>
<body>

AmCharts.ready(function() {
   ......
   chart.write("chartdiv");
});

<div id="chartdiv" style="width: 100%; height: 400px;"></div>
</body>

What I'm trying to convert it to doesn't except HTML files, only JS, so if I can't convert it, looks like I'll be looking for a new pie chart :)

Thanks in advance!

Cassie :)

3
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by stbuchok
0

I'm trying to create a JS file, and stay away from HTML. There is a part of what I'm making that accepts lines of HTML, but it's in an XML file, and it's not doing what the div is supposed to do.

0

You can use createElement(), however, chances are you are going about this all wrong. Can you explain in detail exactly what needs to happen (not what you are doing)? What is the problem you are ultimately trying to solve?

0

The problem I was trying to fix was getting the chart to draw on the screen. I tried a couple of things in the HTML file (i.e. taking the div tag out), and the chart broke without it.

So basically, the DIV tag is creating the place holder and when the chart is written, it's going to that div. I found a quick fix for now (adding the div to the XML file), but that's not what I want to end up doing.

0

Still not sure what you are trying to do really, but the createElement() method will be able to create a div (or any other element) using JavaScript. You'll just need to remember to append that div to another element in order for it to show on the page.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.