I-AM-OBODO Posted July 15, 2015 Share Posted July 15, 2015 hi all i dont know what it is called so i dont know what to goggle cos all my search result have not yielded desired result. i have a table and space for initials. i want so that when i type on the form field it will display on the table. just like the example used on jquery modal form thanks Quote Link to comment https://forums.phpfreaks.com/topic/297303-display-text/ Share on other sites More sharing options...
scootstah Posted July 15, 2015 Share Posted July 15, 2015 You want an "onKeyUp" event on the input field, which will get whatever you typed in and place it in the table using .innerHTML. Quote Link to comment https://forums.phpfreaks.com/topic/297303-display-text/#findComment-1516398 Share on other sites More sharing options...
I-AM-OBODO Posted July 16, 2015 Author Share Posted July 16, 2015 You want an "onKeyUp" event on the input field, which will get whatever you typed in and place it in the table using .innerHTML. could you pls help with example cos i don't know nada on javascript. thanks Quote Link to comment https://forums.phpfreaks.com/topic/297303-display-text/#findComment-1516593 Share on other sites More sharing options...
scootstah Posted July 17, 2015 Share Posted July 17, 2015 http://jsfiddle.net/esv3b854/1/ Quote Link to comment https://forums.phpfreaks.com/topic/297303-display-text/#findComment-1516600 Share on other sites More sharing options...
I-AM-OBODO Posted July 19, 2015 Author Share Posted July 19, 2015 http://jsfiddle.net/esv3b854/1/ thanks alot. i tried to make the input field mandatory but to no avail. also i have a couple of other places i'd like to initial and instead of initialing them one by one, i'd like to initial just one and it will affect the whole three fields. thanks Quote Link to comment https://forums.phpfreaks.com/topic/297303-display-text/#findComment-1516813 Share on other sites More sharing options...
Solution scootstah Posted July 20, 2015 Solution Share Posted July 20, 2015 To add initials in multiple places you just need to select more elements. var el = document.getElementById('initials');This is selecting an element with an id of "initials". In my example, we have <div id="initials"></div>, so this is the element that will be selected. So you can either create more elements with different ID's, and use multiple document.getElementById() calls, or, you can use a different selector such as a class selector. In that case you would just have multiple elements with the same class, and your initials would be added to each one. Here's an example of that: http://jsfiddle.net/22p32vj2/1/ Quote Link to comment https://forums.phpfreaks.com/topic/297303-display-text/#findComment-1516814 Share on other sites More sharing options...
I-AM-OBODO Posted July 20, 2015 Author Share Posted July 20, 2015 To add initials in multiple places you just need to select more elements. var el = document.getElementById('initials');This is selecting an element with an id of "initials". In my example, we have <div id="initials"></div>, so this is the element that will be selected. So you can either create more elements with different ID's, and use multiple document.getElementById() calls, or, you can use a different selector such as a class selector. In that case you would just have multiple elements with the same class, and your initials would be added to each one. Here's an example of that: http://jsfiddle.net/22p32vj2/1/ Thanks a zillion dozen times Quote Link to comment https://forums.phpfreaks.com/topic/297303-display-text/#findComment-1516831 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.