• # April 12, 2013 at 12:45 pm

    I’m trying to switch iFrame source when the user clicks on action link but its not working.. Is there another way maybe jQuery?

    # April 12, 2013 at 1:35 pm

    This reply has been reported for inappropriate content.

    here is my working pen

    # April 12, 2013 at 2:11 pm

    @Htmlmainiac, how would I do this if there were multiple links?

    # April 12, 2013 at 2:25 pm

    $(‘iframe’).attr(‘src’, $(this).attr(‘href’));

    Would work.

    # April 12, 2013 at 2:29 pm

    You can also give your iframe an id and your link that id as target:

    action link

    # April 12, 2013 at 2:34 pm

    I was actually giving the a href a class therefore I can have the links point to different “sites”. But I don’t know how to modify the JS so it would allow multiple links.

    # April 12, 2013 at 2:56 pm

    You can do this without Javascript. Simply add target=”iframename” to any href link you want to display inside the iframe. Like this


    My website works entirely on an iframe. [My Website]( “”)

    # April 12, 2013 at 3:33 pm

    @Jarolin and @CrocoDillon, that is actually easier haha THANKS!
    @Htmlmainiac, Thanks! I’m actually trying to figure JavaScript out it’s for some reason hard for me.

    # April 12, 2013 at 5:40 pm

    This reply has been reported for inappropriate content.

    Ill update the pen for that

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

You must be logged in to reply to this topic.