Add a character counter for meta descriptions

More
9 years 1 month ago - 9 years 4 weeks ago #57501 by iamrobert
Do you wish your metadescription box had a countdown area? So it counts down how many characters you can add.





Add the following code to your administrator template:
Code:
//metadescription counter jQuery(function($) { $( "textarea#jform_metadesc" ).after( "<span id=\"summarychrs\">0</span>" ); function countChar(inobj, maxl, outobj) { var isTextCounter = $('#jform_metadesc'); if (isTextCounter.length > 0) { var len = inobj.value.length; var msg = ' characters left'; if (len >= maxl) { inobj.value = inobj.value.substring(0, maxl); $(outobj).text(0 + msg); } else { $(outobj).text(maxl - len + msg); } } } $(document).ready(function(){ //set up summary field character count countChar($('#jform_metadesc').get(0),160, '#summarychrs'); //show inital value on page load $('#jform_metadesc').keyup(function() { countChar(this, 160, '#summarychrs'); //set up on keyup event function }); }); }); //metadescription counter

Its still a WIP
Attachments:
Last edit: 9 years 4 weeks ago by iamrobert. Reason: Was causing jquery error on pages without counter

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #57506 by micker
good idea !!!
maybe we can add same to description field

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #57507 by ggppdk
Hello

we can add this to description field and to textarea fields when HTML editor is not used


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #57508 by iamrobert
Great!

However - I would keep it optional and not by default.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #57524 by ggppdk
Hello

optional, but if a max-length is given and HTML editor is disabled, then i think
- it can be the default behaviour of the new parameter to display it, and optionally turn it off


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.368 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline