javascript - Remove textarea border on button click and select next textarea automatically -
i don't have idea how this, although i've seen on numerouse websites. so, easy code, got stuck.
i create simple app displays textarea
, button. when click button, adds 1 more textarea below. therefore, want remove frame (border) of previous textarea
when click add button. , also, automatically select next 1 typing.
clarification: user types in textarea text, , presses red button. becomes green. , border of first textarea disapears (only text remains) , added textarea below automatically selected (clicked) , user can type in text , again press red button , on. if user decide return , change text of previous textarea, border appear again.
and here code:
<textarea rows="3" cols="30" ></textarea><br/> <input type="button" style="background-color:red;width:48x;height:20px;" id="btn1" value="add" onclick="change(this);addmore();"> <div id="inner"></div><br/> function change(myinput) { myinput.style.backgroundcolor = "green"; } function addmore() { var textarea = document.createelement("textarea"); textarea.rows = 3; textarea.cols = 30; var div = document.createelement("div"); div.innerhtml = textarea.outerhtml + '<br/><input type="button" style="background-color:red;width:48px;height:20px;" id="btn2" value="add" onclick="change(this);addmore();"><br/>'; document.getelementbyid("inner").appendchild(div); }
Comments
Post a Comment