Skip to content

Instantly share code, notes, and snippets.

@asyndrige
Created March 4, 2015 10:50
Show Gist options
  • Save asyndrige/a6be14b2fed928386a16 to your computer and use it in GitHub Desktop.
Save asyndrige/a6be14b2fed928386a16 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$('.field_name').append('<div class="name_counter" style="display:inline;">'+$('#StoreProduct_name').val().length+'/60</div>');
$('#StoreProduct_name').keyup(function() {
$('.name_counter').empty();
$('.name_counter').append($(this).val().length + '/60');
});
$('.field_meta_title').append('<div class="meta_title_counter" style="display:inline;">'+$('#StoreProduct_meta_title').val().length+'/70</div>');
$('#StoreProduct_meta_title').keyup(function() {
$('.meta_title_counter').empty();
$('.meta_title_counter').append($(this).val().length + '/70');
});
$('.field_meta_description').append('<div class="meta_description_counter">'+$('#StoreProduct_meta_description').val().length+'/250</div>');
$('.meta_description_counter').css({
'display': 'inline',
'position': 'relative',
'bottom': '35px'
});
$('#StoreProduct_meta_description').keyup(function() {
$('.meta_description_counter').empty();
$('.meta_description_counter').append($(this).val().length + '/250');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment