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
Anusha Srivastava
NA
69
0
JQuery for Html editor to limit charecter
Jun 6 2011 4:26 AM
function limitChars(textid, limit, infodiv) {
var text = $('#' + textid).val();
var textlength = text.split(' ').length;
if (textlength > limit+1) {
$('#' + infodiv).html('You cannot write more then ' + limit + ' words!');
alert("word limit exeed..!!")
$('#' + textid).val(text.substr(0, limit));
return false;
}
else {
$('#' + infodiv).html('You have ' + (limit - textlength) + ' Words left.');
return true;
}
}
$(document).ready(function() {
$('#ctl00_Content_TxtResponseOne_ctl02_ctl01').keyup(function() {
limitChars('ctl00_Content_TxtResponseOne_ctl02_ctl01', 200, 'ctl00_Content_ROneCount');
})
$('#ctl00_Content_TxtResponseTwo_ctl02_ctl01').keyup(function() {
limitChars('ctl00_Content_TxtResponseTwo_ctl02_ctl01', 500, 'ctl00_Content_RTwoCount');
})
$('#ctl00_Content_TxtResponseThree_ctl02_ctl01').keyup(function() {
limitChars('ctl00_Content_TxtResponseThree_ctl02_ctl01', 500, 'ctl00_Content_RThreeCount');
})
$('#ctl00_Content_TxtResponseFour_ctl02_ctl01').keyup(function() {
limitChars('ctl00_Content_TxtResponseFour_ctl02_ctl01', 1000, 'ctl00_Content_RFourCount');
})
$('#ctl00_Content_TxtResponseFive_ctl02_ctl01').keyup(function() {
limitChars('ctl00_Content_TxtResponseFive_ctl02_ctl01', 500, 'ctl00_Content_RFiveCount');
})
$('#ctl00_Content_TxtResponseSix_ctl02_ctl01').keyup(function() {
limitChars('ctl00_Content_TxtResponseSix_ctl02_ctl01', 500, 'ctl00_Content_RSixCount');
})
$('#ctl00_Content_TxtResponseSeven_ctl02_ctl01').keyup(function() {
limitChars('ctl00_Content_TxtResponseSeven_ctl02_ctl01', 500, 'ctl00_Content_RSevenCount');
})
$('#ctl00_Content_TxtResponseEight_ctl02_ctl01').keyup(function() {
limitChars('ctl00_Content_TxtResponseEight_ctl02_ctl01', 500, 'ctl00_Content_REightCount');
})
$('#ctl00_Content_TxtResponseNine_ctl02_ctl01').keyup(function() {
limitChars('ctl00_Content_TxtResponseNine_ctl02_ctl01', 800, 'ctl00_Content_RNineCount');
})
});
<
table
width
="100%"
border
="0"
cellpadding
="0"
cellspacing
="0"
runat
="server"
id
="Table1">
<
tr
>
<
td
align
="left"
valign
="top"
width
="60%"
class
="grey_ver11">
<
cc2
:
editor
width
="600px"
height
="150px"
runat
="server"
id
="TxtResponseOne"></
cc2
:
editor
>
<%
--<custom:CustomEditor id="TxtResponseOne" width="600px" height="150px" runat="server" />--
%>
</
td
>
<
td
align
="right"
class
="grey_ver11"
valign
="top"
width
="40%">
<
div
id
="ROneCount"
class
="DefaultTextBoxCounterStyle"
runat
="server">
</
div
>
</
td
>
</
tr
>
</
table
>
This jquery is working for Html mode of editior bue not working for ythe design mode of it. do any one have solution.
Reply
Answers (
5
)
Floating image
Moving of text with in the box reg