I get the engine code:

<div class="tags"><a href="#">Pretty</a>, <a href="#">Good</a>, <a href="#">Creative</a></div> 

I do not need a comma. How can I get rid of it with jQuery?

Yes, it would be possible to dig in dvzhik, but work for a public ...

  • And what's with jQuery? In your case, you need to look for patterns and use the regular schedule. Although, I would look in the direction of how to avoid this already when forming a conclusion. - Deonis

3 answers 3

Try this:

 var text = $('.tags').html(); text = text.replace(',',''); $('.tags').html(text); 
  • @ anna241188, To format a code, select it with the mouse and click on the {} button of the editor. - Deleted
  • @Iranda, thanks - anna241188

Connect jQuery for two lines of javascript?

 var html = document.getElementsByClassName('tags')[0]; html.innerHTML = str.innerHTML.replace(/,/gi, ''); 
  • The fact of the matter is that jQuery is used there, and not at all for two. - inferusvv
  • one
    You can assume that I wrote this "on jQuery". - Zhukov Roman

It is not completely clear what comma you need to remove. But in jQuery you can replace a specific block like this:

 jQuery('селектор*').html('текст которым ты хочешь заменить'); 
  • So this thing completely replaces the text in the block. If you look at an example, you can see the commas after the links. They are not needed - inferusvv
  • Well, then you need to first pull the data into a variable, then replace everything you need in it and add it to this block. It looks like this: var myDiv = jQuery ('selector'). Html (); myDiv = here you change everything you need; jQuery ('selector'). html (myDiv); - SergioVasus
  • So it is clear how it will be)) The question then is how to do it? - inferusvv