Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 7 Years, 10 Months, 1 Week ago Please help to fix this JavaScript!
#1
Solved: 7 Years, 10 Months, 1 Week ago
Guys is there a way to make this code not to count blank spaces only characters.

And if it's possible not to count BBcode?

Here is the code because many say I don't want to share my code with this community!

Event.observe(window, 'load', function (min) {
	if($('message_new')) {
	var elTextarea      = $('message_new');
	} else {
	var elTextarea      = $('message');
	}

	var elCountStart   = $$('.countstart').first();
	var minLength       = Number(minchars);
	var space = 0;
	
	elCountStart.innerHTML = 0;

	elTextarea.observe('keyup', function ()  {  
	
		if(elTextarea.value.match(/\s/g,''))  {
			space = elTextarea.value.match(/\s/g,'').length;
			if( elTextarea.value.length >= space ) { 
				charas = elTextarea.value.length;
			}
		} else {
			charas = elTextarea.value.length;
		}
          
		elCountStart.innerHTML = + Number( charas );

	})

});



And this one too:
<script type="text/javascript">
function countit(what){
formcontent=what.form.subject.value;
what.form.displaycount.value=formcontent.length;
}
</script>


Forum Jump:


Users browsing this thread: 1 Guest(s)