I have a div with anchor tag separated with commas. I am checking if the count of anchor is more than six, if yes, I am hiding all the anchor tags, but the commas with space are remaining.
How to remove commas along with the space?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One trick you could do is not adding those separators (commas) directly into the markup, but using CSS
:afterpseudo-selector andcontentproperty. This way the commas become attached to the links.HTML:
CSS:
Please check out my jsFiddle Demo. Click the links to remove them.
Alternatively, you can also hide the surrounding div, so everything inside will become hidden (
$('#parentdiv').hide()). I could give you a better and more detailed if you provided any details about your problem (current code, what do you expect to see, a jsFiddle would be best).