Give help. Get help.

  • # November 14, 2017 at 2:58 pm

    I tried adding some simple JS functionality to my page at CodePen, but I just can’t seem to get past this one problem: the one link in my CodePen-page just goes to a white page for some reason. I have no idea why this even happens. I tried adding preventDefault(), but that didn’t work either.

    What have I done wrong? All my other links goes to nothing, as they should. It’s just this one link in my mobile layout. Not even the console log works, strangely enough.

    # November 14, 2017 at 8:08 pm

    It’s because the element also has an inline event inside the HTML itself:


    Binding events directly precedes the addEventListener method:

    So that’ll work despite the inline event (it overwrites it).

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.