javascript - Neither .on or .live functions are recognized -


i frustrated right now. have been trying past half hour event delegation work. tried using .on , chrome told me wasn't function.

i searched question

$(...).on not function - jquery error

and thought because using earlier version of jquery. because of that, decided include latest version of jquery google developer's website

https://developers.google.com/speed/libraries/

here's included @ end of body tag

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 

i thought solve problem

if click on link under view source (ctrl + u) , click on jquery file, source code, leads me believe loaded properly.

i tried use .live function , found out wasn't function either. there's no chance have syntax error either

$("td > a")[0].on("click", function() { alert('hi') }) 

yet, following output console

uncaught typeerror: $(...)[0].on not function @ :2:16 @ object.injectedscript._evaluateon (:895:140) @ object.injectedscript._evaluateandwrap (:828:34) @ object.injectedscript.evaluate (:694:21)

i tried copying , pasting minified jquery code javascript file, , including way, failed.

is issue content distribution network(cdn) or problem version itself?

i know jquery 2 supports modern browsers, using google chrome. can not understand problem is.

has else ran problem before? or advice appreciated.

edit:

`jquery.fn.jquery` returns `2.1.3` 

you're attempting apply jquery method raw dom object. index specified no longer have jquery object selected.

also, way you've structured on() function doesn't employ event delegation. try this:

$(document).on("td > a:eq(0)", "click", function() { alert('hi') }); 

Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -