How do I load an url in iframe with Jquery

后端 未结 5 1448
日久生厌
日久生厌 2020-11-28 04:14

I want to load an iframe on click, this is what I have so far:

$(\"#frame\").click(function () { 
      $(\'this\').load(\"http://www.google.com/\");
    });         


        
5条回答
  •  执笔经年
    2020-11-28 04:59

    $("#button").click(function () { 
        $("#frame").attr("src", "http://www.example.com/");
    });
    

    HTML:

     

提交回复
热议问题