//declaration des variables
var ligneArray = [];
//pour chaque element de classe tableFieldError, recuperer la ligne
var errorArray = $(".tableFieldError");
console.log(errorArray);
$.each(errorArray, function(i,mtd){
var ligne = $(mtd).parent("tr");
//ajouter la ligne dans la liste si elle n'y est pas deja
var trouve = false;
$.each(ligneArray,function(j,mtr){
trouve = mtr === ligne;
});
if (!trouve){
ligneArray.push(ligne);
}
});
console.log(ligneArray);
//pour chaque ligne, ajouter l'icone en début de ligne.
var cont = $("#container");
if(typeof cont == "undefined")return false;
//si le container n'a pas la prop css relative, l'ajouter
var contTop = cont.offset().top;
var contLeft = cont.offset().left;
$.each(ligneArray,function(j,tr){
var icon = $("<div>");
icon.addClass("errorIcon");
//coordonnées de la ligne par rapport au container
icon.css({
"top":$(this).offset().top - contTop - cont.scrollTop() +"px",
"left":"-5px"
});
cont.append(icon);
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.