I want to apply validation where user cannot input name starting from blank space, in my present code whe user is giving value using spacebar its successfully entering blank value. I want to apply validation where user can use space but not in the beginning
if($('#workspaceNameUpdate').val().trim().length == 0 && $('#workspaceNameUpdate').val() === "") {
$('#workspaceNameUpdate').addClass('error');
$('#workspaceNameUpdateError').removeClass('hidden');
}
I am using trim class but its not working its not entering into the error block!