Those kind of TypeError
errors on jQuery functions are typically caused by having duplicate different versioned jQuery JS files loaded by the webapp. PrimeFaces as being a jQuery-based JSF component library already automatically loads jQuery by itself. You thus do not need to manually load another jQuery JS file yourself on top of PrimeFaces one via <script>
/<h:outputScript>
. If you remove it, then this error should disappear.
If you happen to have a page wherein you'd like to use some jQuery, but the page itself doesn't utilize any PrimeFaces component and thus doesn't necessarily have PrimeFaces-bundled jQuery automatically loaded, then you can always explicitly load it yourself by simply adding the following line:
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
This will explicitly load the PrimeFaces library-bundled jQuery file. Note: the target="head"
can be omitted when it's already inside the <h:head>
. Otherwise, e.g. when inside <h:body>
or <ui:define>
of a template client, it would be automatically relocated to head. Another note: you can safely use this line in a page which actually requires PrimeFaces-bundled jQuery. It won't end up in a duplciate load.