Edit this page

up.syntax up.$compiler(selector, [options], compiler)
JavaScript function

Registers a function to be called when an element with the given selector is inserted into the DOM. The function is called with each matching element as a jQuery object.

If you're not using jQuery, use up.compiler() instead, which calls the compiler function with a native element.

Example

This jQuery compiler will insert the current time into a <div class='current-time'></div>:

up.$compiler('.current-time', function($element) {
  var now = new Date()
  $element.text(now.toString())
})

Parameters

selector string

The selector to match.

[options] Object optional
compiler Function($element, data)

The function to call when a matching element is inserted. See compiler argument for up.compiler().

This website uses cookies to improve usability and analyze traffic.
I accept or learn more