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

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -