html - How to show the output in textarea when using $('div') and CSS (JavaScript) -


when use codes, prints result in new html page, how can print results in nominated textarea? lets want result shown in: bookform.mytext.value

update: please note btitle supposed italic

html:

<div contenteditable="true"></div> 

css:

span{     font-style: italic; } 

javascript:

btitle = bookform.txttitle.value; bname = bookform.txtname.value; bnumber = bookform.txtnumber.value;  var concatbook = "<span>"+btitle+"</span> "+bname+" sold "+bnumber+" copies." $('div').html(concatbook); 

add textarea in id "mytext"

     <textarea id="mytext" name="somename"></textarea> 

add javascript

      btitle = bookform.txttitle.value;       bname = bookform.txtname.value;       bnumber = bookform.txtnumber.value;        var concatbook = ""+btitle+" "+bname+" sold "+bnumber+" copies.";       $('#mytext').val(concatbook);  //this display result in textarea       $('#mytext').css('font-style', 'italic'); 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -