html - Inserting text into textarea with javascript for google chrome extension -
i trying extend functionality of existing google chrome extension. using wrike google chrome extension, goal add together button (or buttons) add together text description field (a textarea). desired effect if user clicks "add template" button, code/text inserted textarea id="description" native wrike chrome extension. below find of code have been working with.
here description part of form. located in createtask.html
<div class="main-description main-row"> <textarea placeholder="click add together description" id="description" class="main-description-text"></textarea> </div>
this button created initiate adding text textarea:
<span class="btn m-green btn-addtemp" id="link">add template</span>
within template.js (which linked external .js file within createtask.html:
function inserttext(text) { document.getelementbyid("description").innerhtml = text; } document.addeventlistener('domcontentloaded', function() { var link = document.getelementbyid('link'); link.addeventlistener('click', function() { inserttext('sample text here'); }); });
i can code insert 'sample text here' div id, cannot insert textarea id=description. help appreciated , more happy provide more detailed info if necessary. thanks!
try element.value:
function inserttext(text) { document.getelementbyid("description").value= text; }
javascript html google-chrome textarea
No comments:
Post a Comment