if ($('#voting4005 > .already-voted').length == 0) { $('#result4005 + a').after('Already voted!'); }