user2005646
user2005646

Reputation: 148

The link not load in the iframe

I have this code to open link in iframe and hide iframe until link is clicked then hide link after link is clicked

<script>

$(document).ready(function(){
    $("#iframe1").hide();
    $("#theLink").click(function(){
        $("#iframe1").show();
        $("#linkDiv").hide();
        return false;
    });
});

</script>

<div id="linkDiv">
    <a href="http://www.example.com" id="theLink" target="iframe1">Link</a>
</div>
<br/><br/>
<iframe id="iframe1" name="iframe1" src="#"></iframe>

The link not load in the iframe

Can anyone solve this problem please ?

Thank you.

Upvotes: 0

Views: 70

Answers (1)

Quentin
Quentin

Reputation: 943591

return false cancels the default action so the link isn't followed. Take it out.

Upvotes: 1

Related Questions