Adding HTML5 hidden attribute support to jQuery .toggle() method

http://stackoverflow.com/questions/14635847/adding-html5-hidden-attribute-support-to-jquery-toggle-method?lq=1

by Jeromy French

HTML

<p id="myElement">Hi there</p>
<button>Give it a whirl</button>

JavaScript

$('button').click(function() {
    $('#myElement').toggle(function() {
        if ($(this).css('display')==='none'){
           $(this).prop('hidden', 'hidden');
        }
        else
        {
           $(this).removeProp('hidden');
        }
    })
})