1

here is the following DIV structure:

<div class="demo">
    <div id="tabs">
        <div id="tabs-1"></div>
        <div id="tabs-2"></div>
</div></div>

How do I access 'tabs-2' from JavaScript?

var plot2 = $.jqplot ('tabs-2', [points], {...

This JavaScript code works fine only for the 1st-level DIV containers, e.g. 'demo'.

2 Answers 2

1

What about

document.getElementById('tabs-2')

?

Sign up to request clarification or add additional context in comments.

3 Comments

Do you mean this? var plot2 = $.jqplot (document.getElementById('tabs-2'), [points], {... This does not work for me.
@YouKuper I don't know what is jqplot (I guess it's a library). But if you want a reference to the element, yes, use that.
@YouKuper It seems you don't need a reference to the element, you can pass only the id. Then, $.jqplot ('tabs-2', [points], {... should work. Can you give us a jsfiddle with the complete code?
0
document.getElementById('tabs-2')

Try this..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.