﻿
$.fn.getChildCount = function()
{
    return $(this).children().length;
};

$.fn.getNthChild = function(index)
{
    return $(this).children().eq(index);
};

$.fn.getClosestParent = function(parentSelector)
{
    return $(this).parents(parentSelector + ':first');
};

$.fn.tagName = function()
{
    if (this == null)
    {
        return '';
    }

    return this.get(0).tagName;
}

$.fn.className = function()
{
    return $(this).attr('class');
}

