How to remove Profile Picture section or the message “You can change your profile picture on Gravatar.”

How to remove profile picture section from WordPress admin panel or the link “You can change your profile picture on Gravatar.”

add_action('admin_footer-profile.php', 'remove_profile_fields');
function remove_profile_fields()
{
    if(current_user_can('custom_role'))
    { ?>
        <script type="text/javascript">/* <![CDATA[ */
var hideFields = [ "aim", "yim", "jabber" ];
jQuery.each( jQuery( "form#your-profile tr" ), function() {
    var field = jQuery( this ).find( "input,textarea,select" ).attr( "id" );
    if ( hideFields.indexOf( field ) != -1 ) {
        jQuery( this ).remove();
    }
});
/* ]]> */</script>
<?php }
}

I’d tried above code but it is not working at all.

Solutions Collecting From Web of "How to remove Profile Picture section or the message “You can change your profile picture on Gravatar.”"

To remove the profile picture row of the table (which includes the gravatar link):

jQuery( "tr.user-profile-picture" ).remove();

To remove that entire “about yourself” table:

jQuery( "tr.user-profile-picture" ).parents("table:first").remove();

Use this type of jQuery call, don’t try to get fancy with the loop.
This is on WP 4.4; earlier versions may have different HTML class names for those elements.