I have the below piece of HTML and the associated jQuery. The htmlfunction is working correctly but the data function isn't affecting the HTML at all, I can't for the life of me figure it out, no errors in the browser at all.
HTML
<span id="usernameStatus" data-valid="0">x</span>
jQuery
data is returned by an AJAX call, it will only ever be true or false.
function validUsername(data)
{        
    if (data === 'true') {
        $("#usernameStatus").html("y").data("valid", 1);
    } else {
        $("#usernameStatus").html("x").data("valid", 0);
    }
}
 
     
     
    