1

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

$('[ajaxify]')

This gets me 361 objects. How to get the values?

1
  • 3
    api.jquery.com/each or api.jquery.com/map if you want to create an array of the values. I'd also suggest you use a data-* attribute for this as ajaxify is non-standard. Commented Jun 13, 2016 at 15:52

1 Answer 1

2

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

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

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! It's a facebook page so I can't do much about it :)
@bbPi : glad to help you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.