how can I create a comment box or reply box according to the length of your text.I mean, just like facebook, when you want to post something, and when your text length is longer than the default length, which facebook post box allows 3 lines, and when the user type it and get to the end of the box, then the box resize,and create a new line.
Asked
Active
Viewed 154 times
1 Answers
0
Use Dojo Tool Kit Script with your code, I hope it accomplish your question!!!
Demo http://jsfiddle.net/8gCVa/2/
HTML
<head>
<script type="text/javascript" src="http://dojotoolkit.org/reference-guide/1.9/_static/js/dojo/dojo.js"></script>
</head>
<body class="claro">
<textarea name="myarea"
autocomplete="off" class="dijitTextBox dijitTextArea dijitExpandingTextArea"
tabindex="0" id="myarea" rows="1" widgetid="myarea" value="Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."
style="overflow-y: hidden; overflow-x: auto; box-sizing: border-box; width: 200px;
height: 294px;"></textarea>
</body>
Script
require(["dijit/form/Textarea", "dojo/domReady!"], function (Textarea) {
var textarea = new Textarea({
name: "myarea",
value: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.",
style: "width:200px;"
}, "myarea").startup(); ;
});
CSS
textarea{
resize:none;
}
Thanks

Sam1604
- 1,459
- 2
- 16
- 26