www.webdeveloper.com
Results 1 to 6 of 6

Thread: <a>child and Javascript

  1. #1
    Join Date
    Oct 2012
    Posts
    18

    <a>child and Javascript

    Hello! Could someone help me out how to create a link with just using JC. Its needs to be attached to the end of the fourth <p> that comes from the second <div> and it shall show <p class"shower"> that is hidden. I have tried a few things and failed hard. Sadly i cant find it on youtube either. Some help would be really appreciatet

  2. #2
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,143
    Here's an example of how to add a link to the fourth paragraph of the 2nd div:
    http://jsfiddle.net/AtRxG/

  3. #3
    Join Date
    Oct 2012
    Posts
    18
    Thank you for the reply mate. But sadly i am not allowed to use jQuery ;(

  4. #4
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,143
    Why not? Is it homework?

  5. #5
    Join Date
    Oct 2012
    Posts
    18
    jepp. Love that the teacher gives assigments that we even havent gotten too. Started JC 2 days ago. Just learned what document.getElementByID() is :P. haha. Distance course

  6. #6
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,143
    Alrighty, well I hope you learn something from my example then

    Try this one:
    http://jsfiddle.net/AtRxG/7/

    Basically, I'm getting the elements by the tag name (div and p). This will return all the elements in an array, so then I need to tell it which one I want in the square brackets. After I've found the fourthP, I can modify the HTML.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles