Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Backend Character Limit

Open tharindu-wj opened this issue 8 years ago • 5 comments

Is there any method for limit character of wp-editor from backend?

tharindu-wj avatar Jun 06 '18 12:06 tharindu-wj

Waiting for a answer...

rdanusha avatar Jun 06 '18 16:06 rdanusha

No, there is no such kind of method. But why do you need this?

ViorelEremia avatar Jun 07 '18 11:06 ViorelEremia

I have developed some custom shortcodes. I need to limit characters of some input text fields. Is there any possibilities to do this?

rdanusha avatar Jun 07 '18 12:06 rdanusha

Every input has an id you hanlde it example for length 5:

$( document ).on( 'change', '#your input id', function () {
	var val = $( this ).val();

	if ( val.length > 5 ) {
		$( this ).val( val.substr( 0, 5 ) );
	}
} );

ViorelEremia avatar Jun 07 '18 13:06 ViorelEremia

Thank you. I will try this.

tharindu-wj avatar Jun 10 '18 16:06 tharindu-wj