jquery-steps
Version:
A powerful jQuery wizard plugin that supports accessibility and HTML5
52 lines (46 loc) • 1.41 kB
JavaScript
$.fn.extend({
_aria: function (name, value)
{
return this.attr("aria-" + name, value);
},
_removeAria: function (name)
{
return this.removeAttr("aria-" + name);
},
_enableAria: function (enable)
{
return (enable == null || enable) ?
this.removeClass("disabled")._aria("disabled", "false") :
this.addClass("disabled")._aria("disabled", "true");
},
_showAria: function (show)
{
return (show == null || show) ?
this.show()._aria("hidden", "false") :
this.hide()._aria("hidden", "true");
},
_selectAria: function (select)
{
return (select == null || select) ?
this.addClass("current")._aria("selected", "true") :
this.removeClass("current")._aria("selected", "false");
},
_id: function (id)
{
return (id) ? this.attr("id", id) : this.attr("id");
}
});
if (!String.prototype.format)
{
String.prototype.format = function()
{
var args = (arguments.length === 1 && $.isArray(arguments[0])) ? arguments[0] : arguments;
var formattedString = this;
for (var i = 0; i < args.length; i++)
{
var pattern = new RegExp("\\{" + i + "\\}", "gm");
formattedString = formattedString.replace(pattern, args[i]);
}
return formattedString;
};
}