I have written the following code. But it is removing only
not <br>
var docDesc = docDescription.replace(/( )*/g,"");
var docDesc1 = docDescription.replace(/(<br>)*/g,"");
It typically looks like a small, dark-colored fleck. It may look like a splinter if it's just the tick's mouthparts. For an additional sign of a tick head still being stuck, you may also inspect the tick's body to see if it looks like pieces of the head broke off.
Clean the area of the tick bite with rubbing alcohol. Using a sterilized tweezer, gently attempt to remove the tick's head with steady, strong pressure as you pull outward. If a sterilized tweezer doesn't work, you may also try to use a needle to widen the area of the tick bite to try to get the head out.
Do not try to kill, smother, or lubricate the tick with oil, alcohol, petroleum jelly, or similar material while the tick is still embedded in the skin.
You can achieve removing <br>
with CSS alone:
#some_element br {
display: none;
}
If that doesn't fit your needs, and you want to really delete each <br>
, it depends, if docDescription
is really a string (then one of the above solutions should work, notably Matt Blaine's) or a DOM node. In the latter case, you have to loop through the br elements:
//jquery method:
$('br').remove();
// plain JS:
var brs = common_parent_element.getElementsByTagName('br');
while (brs.length) {
brs[0].parentNode.removeChild(brs[0]);
}
Edit: Why Matt Baline's suggestion? Because he also handles the case, where the <br>
appears in an XHTML context with closing slash. However, more complete would be this:
/<br[^>]*>/
Try:
var docDesc = docDescription.replace(/[&]nbsp[;]/gi," "); // removes all occurrences of
docDesc = docDesc.replace(/[<]br[^>]*[>]/gi,""); // removes all <br>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With