-2

I'm currently developing my website for mobile version in wordpress and customizing it with HTML/CSS & jQuery/JS.

The problem I'm facing at the moment is, that I would like to remove -> “ ” from a string. Currently it looks as it shows on the image bellow:

enter image description here

The orignal HTML code of the category result:

<div class="nm-shop-results-bar  is-category">
   <ul>
      <li class="nm-shop-search-taxonomy-reset">
         <a id="nm-shop-search-taxonomy-reset" data-shop-url="http://localhost/wordpress/shop/"> 
            <span>“Avtoreparatura”</span>
         </a>
      </li>
   </ul>
</div>

With the code bellow, I've removed "Showing" next to the category:

        jQuery('.nm-shop-search-taxonomy-reset a:contains("Showing")').each(function(){
          jQuery(this).html(jQuery(this).html().split("Showing").join(""));
            jQuery("#nm-shop-search-taxonomy-reset").removeAttr("href"); });
               jQuery('#nm-shop-search-taxonomy-reset').click(function() {
                    {return false;}
                });

I have tried to remove the -> “ ” with this code; it does the work in console, but I can't execute it properly.

jQuery('#nm-shop-search-taxonomy-reset span').text().replace('“','').replace('”','');

Had anyone dealt with this before? Please help your man out :)

UPDATE The question, has already been answered on the link

0

2 Answers 2

0

You should put it somewhere, so you should do this way:

jQuery('#nm-shop-search-taxonomy-reset span').text(
  jQuery('#nm-shop-search-taxonomy-reset span').text().replace('“','').replace('”','')
);

You're just changing it but not using it anywhere.

Sign up to request clarification or add additional context in comments.

Comments

0

jQuery('#nm-shop-search-taxonomy-reset span').text().replace('“','').replace('”','');

Will do the job, but it returns a new string which you then must capture and set as the new text value:

const el = jQuery('#nm-shop-search-taxonomy-reset span');
el.text(el.text().replace('“','').replace('”',''));

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.