TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hazel Mahmud
1.4k
315
70.7k
div length according to textbox size
Jun 8 2015 10:49 PM
i manage to do expand textbox according to text character but i can't find any reference or site that shows how to expand div according to textbox size.. how do i do that.. my sample code are as below..
<script type="text/javascript" >
$(document).ready(function () {
var counter = 2;
$("#btnAdd").click(function () {
if (counter > 4) {
return false;
}
var newTextBoxDiv = $(document.createElement('div'))
.attr("id", 'TextBoxDiv' + counter);
newTextBoxDiv.after().html('<div class="divWidth" style="background-color:aquamarine; height:50px; width:100px" ><input type="text" name="textbox' + counter + '" size="1' + '"class="inputWithImge"' +
'" onkeyup="Expand(this);"' + '" id="textbox' + counter + '" value=""/> ' +
newTextBoxDiv.appendTo("#LinkTab");
$('#textbox' + counter).focus();
counter++;
});
});
function Expand(obj) {
if (!obj.savesize)
obj.savesize = obj.size;
obj.size = Math.max(obj.savesize, obj.value.length);
}
</script>
Reply
Answers (
2
)
put method
how to use command argument of linkbutton in jquery ?