Edit this page

up.link up:link:follow
DOM event

This event is emitted when a link is followed through Unpoly.

The event is emitted on the <a> element that is being followed.

Changing render options

Listeners may inspect and manipulate render options for the coming fragment update.

The code below will open all form-contained links in an overlay, as to not lose the user's form data:

up.on('up:link:follow', function(event, link) {
  if (link.closest('form')) {
    event.renderOptions.layer = 'new'
  }
})

Event properties

event.target Element

The link element that will be followed.

event.renderOptions Object

An object with render options for the coming fragment update.

Listeners may inspect and modify these options.

event.preventDefault()

Prevents the link from being followed.