﻿$.fn.selectedValue = function(value) {
    this.each(
            function() {
                if (this.nodeName.toLowerCase() != "select") return;

                var optionsLength = this.options.length;

                for (var i = 0; i < optionsLength; i++) {
                    if (this.options[i].value == value) this.options[i].selected = true;
                }
            }
        )
    return this;
}
