Skip to content Skip to sidebar Skip to footer

Remove Blankspace From Td Class With Greasemonkey

If I have webpage with for example alot of 111 22. The numbers are random but classname is the same and the blankspace between the numbers are at

Solution 1:

How about using this

var str = "111 22";    
    str = str.replace(" ","");

code example :

<scripttype="text/javascript">//Page Initial
 $(function() {
     removeSpace();
 });
 functionremoveSpace(){
   var str = $(".house").html();
       str = str.replace(" ","");
       $(".house").html(str);
 }

</script>

Solution 2:

Do this:

var elems = document.querySelectorAll('td.house');
for(var i = 0 ; i < elems.length; i++){
    elems[i].textContent = elems[i].textContent.replace(" ","");
}

Solution 3:

    use the following code:

   <scripttype="text/javascript">window.onload = removeSpace;

    functionremoveSpace() {
        var emt = document.getElementById("mytable");//mytable is the Id of the table
        d = emt.getElementsByTagName("tr")[0],
         r = d.getElementsByTagName("td");
        for (var i = 0; i < r.length; i++) {
            var str = r[i].innerText;
            r[i].innerText = str.replace(" ", "");
        }
    }

</script>

Post a Comment for "Remove Blankspace From Td Class With Greasemonkey"