Test case for jQuery Ticket 8150

.removeAttr("height") on an image on a scrolled page

by Timmy Willison

HTML

<script src="http://timmywillison.com/jquery/attrhooks/jquery.js"></script>
<p> Some text </p><p> Some text </p><p> Some text </p><p> Some text </p><p> Some text </p>
<p> Some text </p><p> Some text </p><p> Some text </p><p> Some text </p><p> Some text </p>
<p> Some text </p><p> Some text </p><p> Some text </p><p> Some text </p><p> Some text </p>

<img id="img" src="http://i.imgur.com/zJJL4.png" height="768" width="1024" />

<p> <button id="jq">  jQuery - removeAttr("height") </button> <button id="dom"> DOM removeAttribute("height") </button> </p>
<p> Some more text</p><p> Some more text</p><p> Some more text</p><p> Some more text</p>

JavaScript

$(function() {
    $("#jq").click(function() {
        $("img").removeAttr("height");
    });
    
    
    $("#dom").click(function() {
        $("img")[0].removeAttribute("height");
    });
});