adsense

Friday, August 17, 2018

Find an element based on data- value

There are situations where we want to find element based on data- attributes. For instance we have to set validation message at run time for a given field.

In these situations we can use jQuery to easily find an element based on the  data- atttibutes as shown below.

 $('span[data-valmsg-for="' + fieldName + '"]');


cheers,
Samitha


No comments:

Post a Comment