I’m working with Youtube API and Jquery. With a certain script I can get Youtube Feeds as an image, take a look at the example: JsFiddle
I’m trying to do a Jquery click event which will have to invoke another script called ’embedly’ like this:
$("a").click(function(event) {
event.preventDefault();
$(this).embedly({
chars: 220,
nostyle: true,
key:':41f042ec20b04dda84448dc4a46d357d'
});
});
It doesn’t seem to work. When I do this from my desktop the click does not invoke the embedly part and also goes to the url regardless of the prevent default.
You can use event delegation to ensure the handler will be triggered regardless of when the anchor comes into the DOM:
http://jsfiddle.net/bfysr/3/