javascript - HTML - Jquery. Search for duplicates value in custom attribute -


i have html page has custom attributes. want make sure custom attributes in code have unique values. (like check duplicate id's instead of checking property name, check property value unique).

below have posted actual code id's, not know how attributes.

i need make sure custom attributes value unique ids.

/* check dobbelt id */ checkid: function(){     $j('[id]').each(function(){         var ids = $j('[id="'+this.id+'"]');         if(ids.length>1 && ids[0]==this){             alert('multiple ids #'+this.id);         }     }); },   /* check dobbelt value in attribute. */ checkparameter: function(parmname)  {     $j("'["+parmname+"]'").each(function(){         var parmattr = $j(this).attr(parmname);             if(parmattr.length > 1 && paramattr[0] ){                 alert($j(this).id + "dublicates:" + parmattr);             }     }); } 

to check duplicate custom attribute value, can use:

$j("["+parmname+"]").each(function(){     var value = $j(this).attr(parmname);     if($j("["+parmname+"='"+ value + "']").length > 1) {         console.log('duplicate', parmname, 'for value', value);     } }); 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -