can you please tell me how to remove the span tag using jquery. INPUT
<span class="abc">PQR </span>
OUTPUT
PQR
I done before but don't remember I think I used regex or replace .:(
Second
How to replace   by a space(" ") ?
I used like that but not work.
replace(/ /g,'');
For the first part, Tim's answer is great. $('.abd').contents().unwrap()
.
For the second part, please do it properly.
is an html-encoded special characters (non-breakable space), but there are tons of other characters you can encounter (like é
for é
).
Unfortunately there's no built-in standard html decode function, but you can create one with jquery like this:
function htmlDecode(encodedText) {
return $("<div>").html(encodedText).text();
}
For the first part, you can use $('.abc').contents().unwrap()
For the second part see jods answer :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.