Skip to content

Instantly share code, notes, and snippets.

@gorosz
Created September 17, 2013 06:38
Show Gist options
  • Save gorosz/6590763 to your computer and use it in GitHub Desktop.
Save gorosz/6590763 to your computer and use it in GitHub Desktop.
[javascript] - Toggle_attribute
<script>
(function($) {
$.fn.toggleReadonly = function() {
return this.each(function() {
var $this = $(this);
if ($this.attr('readonly')) $this.removeAttr('readonly');
else $this.attr('readonly', 'readonly');
});
};
})(jQuery);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment