Javascript Remove Row From Table

Here’s a short function to remove a row from a table using the row’s id

function removeRow(id) {
  var tr = document.getElementById(id);
  if (tr) {
    if (tr.nodeName == 'TR') {
      var tbl = tr; // Look up the hierarchy for TABLE
      while (tbl != document && tbl.nodeName != 'TABLE') {
        tbl = tbl.parentNode;
      }
 
      if (tbl && tbl.nodeName == 'TABLE') {
        while (tr.hasChildNodes()) {
          tr.removeChild( tr.lastChild );
        }
      tr.parentNode.removeChild( tr );
      }
    } else {
      alert( 'Specified document element is not a TR. id=' + id );
    }
  } else {
    alert( 'Specified document element is not found. id=' + id );
  }
}

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(1 votes, average: 5.00 out of 5)
 Loading ...

Join the Entrecard List

If you are an Entrecard user, join this list. Just use your Entrecard user id and click on the join button on the right side of the site. Advertise your site and attract lots of visitors. Who knows, they’d drop on your widget too! Go here to join

.

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(No Ratings Yet)
 Loading ...

Javascript Trim

Javascript does not provide a trim() function so you would have to make on yourself. You can use this nifty pre-made function.

function trim(stringToTrim) {
  return stringToTrim.replace(/^\s+|\s+$/g,"");
}

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(No Ratings Yet)
 Loading ...

Most Useful Wordpress Plugins

So there are a lot of topics regarding the best and the most in demand plugins for Wordpress. However, not all of them suit your needs, hence I’m listing here the WP plugins that my blog uses that I find very useful.

Excerpt Editor - Add or edit excerpts for Posts and Pages. If you check the main page of my blog, you can see the word “continue reading”. You can actually customize it to any word that you want to be displayed e.g. “read more”.

Head META Description - Insert HTML META description tag: excerpt/content brief for post/Page, description for category, and blog tagline for everything else.

My Page Order - Useful plugin to sort your pages in order. Some WP templates actually mess up the ordering of your pages especially when you add up new ones. This plugin solves that dilemna.

Search Meter - Good for admin purposes. This plugin outlines what topic your visitors search in your blog. This way, you would know and possibly write more about the topics that they searched.

Secure and Accessible PHP Contact Form - This is the plugin that I used for my contact me form.

wp-cache - Very fast cache module, lets you cache your posts and your layout so that server does not have to reload contents every time a visitor checks out your blog.

WP-PageNavi - Adds a more advanced paging navigation to your WordPress blog

For now, these are the plugins that my blog uses. If there would be any new plugins that I come across, I will post them here so as to give new and old WP users a headstart.

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(No Ratings Yet)
 Loading ...