Here we can do, copy this jquery plugins :
jQuery.fn.maxLength = function(max){this.each(function(){//Get the type of the matched elementvar type = this.tagName.toLowerCase();//If the type property exists, save it in lower casevar inputType = this.type? this.type.toLowerCase() : null;//Check if is a input type=text OR type=passwordif(type == “input” && inputType == “text” || inputType == “password”){//Apply the standard maxLengththis.maxLength = max;}//Check if the element is a textareaelse if(type == “textarea”){//Add the key press eventthis.onkeypress = function(e){//Get the event object (for IE)var ob = e || event;//Get the code of key pressedvar keyCode = ob.keyCode;//Check if it has a selected textvar hasSelection = document.selection? document.selection.createRange().text.length > 0 : this.selectionStart != this.selectionEnd;//return false if can’t write morereturn !(this.value.length >= max && (keyCode > 50 || keyCode == 32 || keyCode == 0 || keyCode == 13) && !ob.ctrlKey && !ob.altKey && !hasSelection);};//Add the key up eventthis.onkeyup = function(){//If the keypress fail and allow write more text that required, this event will remove itif(this.value.length > max){this.value = this.value.substring(0,max);}};}});};
For execute , put on head (but not on your head ):
<script type=”text/javascript”>
$().ready(function(){
$(“#leasure_narrative”).maxLength(300);
});
</script>
🙂 MAS Ardhit… klo bisa kasih link contoh juga dunk…. biar bisa liat juga hasilnya.
Numpang Cop Pas yah 🙂
Chayoooo Smangat Mas ^_^
heh bow….
gimana kalo mas bowo ajah yang kasih contoh… =P
btw, kemana ajah kamu ?
I see a lot of interesting articles on your blog. You have to spend a lot of time writing, i
know how to save you a lot of work, there is a tool that creates unique, SEO friendly articles in couple of minutes,
just type in google – laranita’s free content source