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' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -