|
-
Sep 14th, 2012, 04:52 AM
#1
Thread Starter
Addicted Member
[RESOLVED] jquery display text
hi gurus,
need your help. I had tried making this simple html with jquery.
I want to display the text on the input button to the text area simultaneously.
how do i do it? please check code below which I had started. Thank you.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</style>
</head>
<body>
<form>
<fieldset>
<label for="target">Type Something:</label>
<input id="target" type="text" />
</fieldset>
</form>
<form name="display_form">
<textarea id="txtdisp" rows="2" cols="20">
</textarea>
</form>
<script>
var txt= $("#target").val();
onKeyUp="display_form.form.txtdisp.value=txt";
</script>
</body>
</html>
The taller the bamboo grows the lower it bends... 
-
Sep 14th, 2012, 11:58 PM
#2
Re: jquery display text
Try this:
Code:
<script>
$(document).ready(function(){
$('#target').keyup(function(){
var txt= $(this).val();
$('#txtdisp').val(txt);
});
});
</script>
To test it live, check this fiddle: http://jsfiddle.net/4zrZg/
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 15th, 2012, 07:35 PM
#3
Thread Starter
Addicted Member
Re: jquery display text
hi akhileshbc, thanks for your help.
it works on the fiddle url that you posted.
but when I tried to save the file as an html file, it doesn't work.
anything i'm missing? thank you.
The taller the bamboo grows the lower it bends... 
-
Sep 16th, 2012, 12:05 PM
#4
Re: jquery display text
Are you trying to save the html file in the fiddle, just by choosing the Save As option from your browser ?
If you want to copy the code from the fiddle, just copy that code and paste it in a new html file. That's all !
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 17th, 2012, 01:22 AM
#5
Thread Starter
Addicted Member
Re: jquery display text
hi akhileshlbc, thanks it works!
it does not work because of the style tag:
<style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</style>
but it works if i removed the <style> </style> tag.
Thanks again
The taller the bamboo grows the lower it bends... 
-
Sep 17th, 2012, 11:42 AM
#6
Re: [RESOLVED] jquery display text

Good luck
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|