0

I actually don't know how to explain what I need, but I will try. I want to create a form in my post, and when a user will fill that form and click submit, some text will be shown in the box below that will be allowed to copy. In this text, the details added in the form will be used. If you visit this post.

https://hackerthylord.blogspot.com/2021/04/privacy-policy-generator.html

You will see it's a privacy policy generator. When you fill out the form and click on generate button. Some code shows below with the value I given in the form below.

I want to create a form like that with just 1 input box. How is this possible?

1 Answers1

0

yes, a simple and basic solution is you use a javascript function for create passage (code) and fill it with entered data. something like this:

<script>
    function createPassage(companyName){
        var passage = "<a href='www.site.com'>"+companyName+"</a>";
        return passage;
    }
</script>

then you put rendered passage (code) every where you want (See below).

How to show javascript code in HTML

Display HTML snippets in HTML

and at last you need a button for copy passage.

https://www.w3schools.com/howto/howto_js_copy_clipboard.asp

note: you can use highlightjs and prismjs for better experience