How to make them disappear & nbsp; & nbsp; & nbsp; & nbsp ;? [closed]

3

I have a div that will serve as a menu.

The problem is that I get these weird characters to format the code and I did not put them there:     

These characters are not visible by code, but are visible through the "Inspect Element" of the internet.

I'vecreatedthis FIDDLE to show the error.

HTML / JQuery

<div id="menuOpt" data-theme="c" data-dismissible="false">
    <div data-role="header" class="ui-bar-b">
        <h1>Opções</h1>
    </div>
    <div role="main" class="ui-content" data-theme="b">
        <button type="button" class="ui-btn-b" ></button>
        <button type="button" class="ui-btn-b" ></button>
        <button type="button" class="ui-btn-b" ></button>
        <button type="button" class="ui-btn-b" ></button>
    </div>
</div>

JS referencing the menu

//atribuir largura ao menu das opçoes
$('#menuOpt').css({
   'width': nav_width + 'px',
// 'atributo':'Valor',
    });

    $("#menuOpt").slideToggle("slow");

Question

Why do these characters appear? How do I remove them?

    
asked by anonymous 15.07.2015 / 12:41

3 answers

4

Could not play. It's probably something that JSFiddle did and you should not worry about it. Note that you are inspecting a site you did not do.

If it appears in another situation, it was the one you should have posted.

In any case this is not an error. These characters are there for some reason and they are important. They represent a blank space. If you remove them you will have different content.

If you have not put it on your page and you are in it (which does not seem to be the case), they will not appear out of nowhere. Something is settling in and you have to analyze the whole to find out what you are putting in. Still, there must be a reason, and removing those characters will cause problems. You have not put anything that gives to say why they are being placed. Without more information, only you can find out why they are there.

Start doing things one step at a time to find out what is putting it.

    
15.07.2015 / 13:05
3

This &nbsp; character represents the "space" character (the same as if you press space on the keyboard.) It is being put by some of its javascripts . These &nbsp; sets are harmless, obs. they should be considered as a single character.

    
15.07.2015 / 13:04
1

The @BorgeB. you're right, you copied that code, you also got the &nbsp; spaces together in the markup.

The problem is even in the HTML code, if you rewrite the code line by line, or simply select entire HTML text using the keyboard shortcuts - ctrl + A and while the text is selected press shift + Tab (to rearrange the code and remove unnecessary spaces) and click run to run the code again in jsFiddle you will see that these spaces will disappear.

Here's an example in jsFiddle: link
Follow the instructions that are in the JavaScript

    
15.07.2015 / 13:40