Jump to content

need help with js code


dezkit
 Share

Recommended Posts

What about

<div onclick="document.getElementById('below').style.display = 'block'; ">This is some text. Click here to show more text.</div><div id="below" style="display:none; ">This is some more text. You cannot see it on page load, click the text above to display it.</div>

But you need to be more clear on what you mean by "and it changes".

Link to comment
Share on other sites

  • 2 months later...

What about

<script type="text/javascript">function change(ele) {element = document.getElementById(ele);(element.style.display == "block") ? element.style.display = "none" : element.style.display = "block";}</script><div onclick="change('below')">This is some text. Click here to show more text.</div><div id="below" style="display:none; ">This is some more text. You cannot see it on page load, click the text above to display it.</div>

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
 Share

×
×
  • Create New...