I'm new to JQuery so this question might be an obvious one, but I have something that appends a text to what's already in an input box:
$('a.blog_category').click(function(){
var current_value = $('#id_category').val();
$('#id_category').val(current_value + ', '+ this.text);
return false
})
I'd like to add an if clause that sounds like:
"If there is already a comma at the end of the line, don't add a comma." "If there is not already a comma AND it's not the first item in the input text, add a comma."
I hope that makes sense.
Thanks for any help beforehand.