Extendable textbox using jQuery (Set Maximum length for multiline textbox)
Introduction:
Here we going to see how using the jquery we can extend the multiline textbox length.
For more search on asp.net search it through the search box provided above.
Description:
We know that the jQuery is the small pre written function using javascript, here I am using jquery1.9.1.js file as a script source.
To use a jquery source file,
we need to declare the script type and source to give the path of the file.
Introduction:
Here we going to see how using the jquery we can extend the multiline textbox length.
For more search on asp.net search it through the search box provided above.
Description:
We know that the jQuery is the small pre written function using javascript, here I am using jquery1.9.1.js file as a script source.
To use a jquery source file,
we need to declare the script type and source to give the path of the file.
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js">
</script>
Above we declare the js source path now we need to open a script tag within that we have to gice our condition function supported by the source js file.
<script type="text/javascript">
here the source file function will be entered
</script>
$(function()
{
$('#txt_example').keypress(function(e) {
var txt = $(this).val();
if (txt.length > 50) {
e.preventDefault();
}
});
});
})
Now on the asp.net page put some asp control.
like
<asp:Textbox ID="txt_example" TextMode="MultiLine" runat="server" ></asp:TextBox>
Now whenever you type in the text box it will stretch upto its maximum value.
For any other clarification comment below.
No comments:
Post a Comment