46
rated 0 times
[
51]
[
5]
/ answers: 1 / hits: 33462
/ 12 Years ago, wed, may 9, 2012, 12:00:00
I have the following code:
HTML:
<div id='example'>
<a href='#' data-name='foo' class='example-link'>Click Me</a>
<a href='#' data-name='bar' class='example-link'>Click Me</a>
</div>
JavaScript
example_view = Backbone.View.extend({
el: $(#example),
events: {
'click .example-link' : 'example_event'
},
example_event : function(event) {
//need to get the data-name here
}
});
how can I get the data-name
attribute of the link that was clicked inside of the example_event
function ?
More From » jquery