bbPi bbPi - 1 year ago 91
Javascript Question

jQuery find all elements with certain attribute and get the value of it

I need to get values of every existing 'ajaxify' attribute on the page.


This gets me
objects. How to get the values?

Answer Source

To get all value as an array, use map(), attr() and get() methods

$('[ajaxify]').map(function() {
  return $(this).attr('ajaxify')

FYI : Always try to use data-*(eg :data-ajaxify) for custom attribute, since it's the standard way to use custom attribute. In than case you can use data() method to get attribute value.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download