0

I am trying to built a embed HTML system in where anyone can copy and paste code snippet in his website to display that.For this I have written requied code in the jquery section . I want to pass that code to a specific div so that that code is run as source code.

jquery part :

 $(document).on("click", "#embedLink", function () {
    var textArea=$("#textArea");
    var url = $('#headerInput').val();
    $("#framInput").val(url);
    var iframe =document.getElementById('ifrm');
    var html= '<iframe id="ifrm" src="'+url+'"width="100%" height="600"    frameborder="0"disable></iframe>';
    textArea.append(html);
    
});

blade template:

<div name="" id="textArea">
               
         </div> 

I want to pass the html value in the div(id="textArea") element.And then I want to show like that....

<iframe id="ifrm" src="'+url+'"width="100%" height="600"    frameborder="0"disable></iframe>

How can do that?

1
  • Are you trying to get a url from user input and show that page in an iframe? Commented Aug 9, 2021 at 18:43

2 Answers 2

1

You may try this way

textArea.append("<iframe id=\"ifrm\" src="+url+" style=\"width: 100%; height: 600;\" frameborder=\"0\" disable></iframe>");
1
  • this not working .The form is open in the iframe for the url Commented Aug 9, 2021 at 18:43
1

This question is mine.At last I found the answer. I have solved that passing the code as text.

I have solved the problem replacing it..

textArea.append(html);

by the following

textArea.text(html);        
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.