Exclude links with a specific class ? #75

Closed
opened 2016-09-28 04:18:56 -05:00 by cpetro · 2 comments
cpetro commented 2016-09-28 04:18:56 -05:00 (Migrated from github.com)

Hi ,

Just wondering if you know a quick way to exclude link elements with certain class such as "a.no-Pjax"

thanks for your help!

CHRIS

Hi , Just wondering if you know a quick way to exclude link elements with certain class such as "a.no-Pjax" thanks for your help! CHRIS
oskarrough commented 2016-11-16 06:27:10 -05:00 (Migrated from github.com)

You could overwrite the getElements method. It's a function that should return a NodeList of elements. How you exclude certain elements is up to you.

Pjax.prototype.getElements = function() {
  return document.querySelectorAll('.js-Pjax:not(.no-Pjax)')
}

new Pjax({})
You could overwrite the `getElements` method. It's a function that should return a NodeList of elements. How you exclude certain elements is up to you. ``` js Pjax.prototype.getElements = function() { return document.querySelectorAll('.js-Pjax:not(.no-Pjax)') } new Pjax({}) ```
BehindTheMath commented 2017-12-20 13:57:55 -05:00 (Migrated from github.com)

Or you could do

new Pjax({
    elements: "a:not(.no-Pjax)"
})
Or you could do ``` new Pjax({ elements: "a:not(.no-Pjax)" }) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#75