Response title
This is preview!
In my script I want to have two types of click functionality, depend on what is clicked and I want to do it in a single function. I decided to make it with namespaces, but the console gives me undefined;
Here is the code:
- $target1.on("click.Bst", $.proxy(self.selectNav, self));
- $target2.on("click.Bst.Type2", $.proxy(self.selectNav, self));
My function selectNav() executes on click, but when I try to get the event.namespace (event is passed as s function parameter) I get undefined.
- selectNav: function(event){
- //other code runs
- console.log(event.namespace); //console log "undefined"
- }
I have a couple of elements like
- <p data-lang-bg="Bulgarian" data-lang-en="English" >Text</p>
- <p data-lang-bg="Other bulgarian text" data-lang-en="Other english text" >Text 2</p>
I have a difficulties writing a jQuery selector, that will select all elements, who have data
attributes starting with data-lang . Is it possible to write such a jQuery selector
© 2013 jQuery Foundation
Sponsored by and others.