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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -