Apply Type Effect to fill input field with variable value with jQuery

Apply Type Effect to fill input field with variable value with jQuery



I was able to copy the value of a hidden field, navigate to another tab and paste it into another input field. I want to apply typewriting for the latter.




$('#send0').click(function()
var user = $('#friend').val();
$("#Profile").removeClass("show");
$('a[href*="Profile"]').removeClass("active").addClass("collapsed");
$('a[href*="Send-Credit"]').addClass("active").removeClass("collapsed");
$("#Send-Credit").addClass("show");
document.getElementById("receiver").setAttribute('value', user);
);



I tried to manipulate below example with no luck. Any idea.


var i = 0;
var user = $('#friend').val();
var speed = 50;

function typeWriter()


if (i < txt.length)
document.getElementById("receiver").setAttribute('value', user.charAt(i));
i++;
setTimeout(typeWriter, speed);





1 Answer
1



One side you are using jQuery for above code and typing effect has not jQuery!



Anyway, You are using setAttribute to apply value, Use jQuery for the same.


setAttribute




var i = 0;
var txt = 'Lorem ipsum dummy text blabla.';
var speed = 50;

function typeWriter()
if (i < txt.length)
$("#demo").val($("#demo").val()+txt.charAt(i));
i++;
setTimeout(typeWriter, speed);


.myText
width:100%;
padding:15px;
display:block;
font-size:20px


<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<button onclick="typeWriter()">Click me</button>

<input type="text" id="demo" class="myText" />






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)