The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HTML Script for Placing Text
Tom G
post Apr 20 2019, 03:44 PM
Post #1





Group: Members
Posts: 1
Joined: 20-April 19
Member No.: 26,883



Hey.... is there basic html script to allow the following?:

In our church app, we can use basic html. What I am trying to do, is have the user type within a "fill in the blank" field, but I want what they typed to also appear way down the page in another paragraph, targeting a specific spot in a sentence in the paragraph down the page. I need to get this done today if it's possible. It's for our Easter service tomorrow. Our pastor just had this idea... hence the urgency!

Thanks for any input!!

Tom
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Apr 21 2019, 03:47 AM
Post #2


.
********

Group: WDG Moderators
Posts: 8,224
Joined: 10-August 06
Member No.: 7



Do you want to allow anyone to write on the page, and do you want the result to be saved and stay visible to any visitor? Then you need a server-side script (like PHP), and it's not a quick task.

But if you only want each user to see the result in his own browser, you can do it relatively fast with java script:

CODE
<p>
<input type="text" id="foo" value="" placeholder="Type your text here">
<input type="button" id="bar" value="View changes">
</p>
...
<p>Some text <span id="baz"></span> more text.</p>

<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function(){
    var foo=document.getElementById('foo');
    var bar=document.getElementById('bar');
    var baz=document.getElementById('baz');
    bar.onclick=function()
    {
        baz.textContent=foo.value;
    }
});
</script>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 22nd September 2019 - 09:35 PM