0

In my code I am trying to introduce a line break after every 11 characters. I have an angular filter for the same which works just fine. The problem is that jsHint is throwing a warning "Bad Escaping" for every <br\> that I have put in. How to suppress the warning for "Bad Escaping" for jshint.

Note: I tried to replace the <br\> with a "\n" but "\n" is not working properly and was displaying unpredictable behavior. Hence kindly do not suggest to replace the same. Please see the code snippet below to observe how I am using <br\>.

if(labelArrayParts.length === 0){
                                    breakPart = value.slice(0,10) + "-" + "<br\>";
                                    leftPart = value.slice(10,value.length);
                                    labelArrayParts[i] = breakPart;
                                    labelArrayParts[i+1] = leftPart;
                                }
Salman A
  • 229,425
  • 77
  • 398
  • 489
Jyotirmoy Pan
  • 687
  • 1
  • 7
  • 22

1 Answers1

1

Remove the escape character. Leave everything else alone.

"<br>";

If you are trying to write XHTML (which I wouldn't recommend as it is more trouble than it is worth, and if you are making this mistake then you won't be getting any benefit from it) then the syntax for an empty element is <br /> not <br\>.

Quentin
  • 800,325
  • 104
  • 1,079
  • 1,205