javascript - Is it possible to find html attributes with specific start? (not specific value) -


imagine have following button:

<button id="id" data-trigger-function = "true", data-value-1="12345", data-value-guid="534-534-657647365-gd">click me function</button> 

is possible, following in called function:

$(this).attr('data-value-'+  * ).each(...); 

the objective use universal selector in attribute name, , not in attribute value (not this: [name^='something']). objective values of data-value-1 , data-value-guid because both have same start.., means data-value be, data-value-qwerty, data-value-xpto, without having know *.

i've searched this, couldn't find this, or mentions this. possible?

thank you! (sorry bad english)

you attributes , loop through them:

$.each(this.attributes, function(index, attr){     var name = attr.name;      if(name.startswith('data-value') {         var value = attr.value;          //you code goes here     } }); 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -