We help IT Professionals succeed at work.

html / javascript innertext

ITsolutionWizard
ITsolutionWizard asked
on
Do you see anything wrong in javascript part?

<div class="container">
    <div class="row">
        <div class="col-md-12">
            <br />
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <h4 class="headline margin-top-0 margin-bottom-30">Tabs Style 2</h4>
            <div class="style-2">
                <!-- Tabs Navigation -->
                <ul class="tabs-nav">
                    @foreach (Domain.Event eItem in rv.EventTypeList())
                    {
                        if (eventCount == 0)
                        {
                            showActive = "Active";
                        }
                        <li class="@showActive"><a onclick="ShowSection('@eItem.EventType')"><i class="@eItem.EventIcon"></i> @eItem.EventType (@eItem.TotalCountEvent)</a></li>
                        eventCount = eventCount + 1;
                    }
                </ul>
                <!-- Tabs Content -->
                <div class="tabs-container" id="tabs-container" style="display:block;">
                    <div style="display:block;" class="tab-content">
                     <p id="tabs-data"></p>
                    </div>                    
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <br /><br />
        </div>
    </div>
</div> 
<script>
    function ShowSection(eventType)
    {
        alert(eventType);
        document.getElementById('tabs-data').innerText = eventType;
    }
</script>

Open in new window

Comment
Watch Question

Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
What are we looking for?

Author

Commented:
Just want know anything wrong with the codes?
I can’t get the inner text show up

Author

Commented:
Any help?
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
"Wrong" can be very subjective - it requires a context.

There is nothing syntactically wrong with the JavaScript.

If it is not doing what you want then you need to state
a) I am expecting it to do XXX
b) I am observing it doing YYY

Without this information we cannot guess what it is you are referring to?

When I put your code into an .html file - load it in my browser and click the <li> item I get an alert and the innerText is updated.

You can see my code here
So again I need to ask - what is the problem you are having.
Jim RiddlesPrepress/OMS Specialist

Commented:
I think we would need to see the rendered HTML.