Skip to content

Instantly share code, notes, and snippets.

@markupboy
Created September 16, 2010 00:29
Show Gist options
  • Save markupboy/581748 to your computer and use it in GitHub Desktop.
Save markupboy/581748 to your computer and use it in GitHub Desktop.
// jquery select replace
$.fn.selectReplace = function(options) {
if (!($.browser.msie && $.browser.version < 7)) {
var opts = $.extend({}, $.fn.selectReplace.defaults, options);
return this.each(function() {
var $this = $(this);
var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
$this.change(function() {
$this.parent().find('span.value').html($this.find('option[value=' + $this.val() + ']').html());
});
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment