add_event()

Add event handler. A typical use of this method is to pass Select2 event name, then a Javascript event handler function. Note that the generated Javascript methods is injected BEFORE end of $(document).ready(…)

Signature:

public function add_event(param1, param2, ....)

Parameter:

  • variable-length argument lists

A list of supported events:

  • change
  • select2-opening
  • select2-open
  • select2-close
  • select2-highlight
  • select2-selecting
  • select2-removing
  • select2-removed
  • select2-loaded
  • select2-focus
  • select2-blur
  • select2-clearing

Example:

$pac -> add_event('select2-close', 'function() { console.log("close"); }');

No related content found.

Tags:

PHP Autocomplete
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.