19
rated 0 times
[
23]
[
4]
/ answers: 1 / hits: 17825
/ 12 Years ago, mon, july 30, 2012, 12:00:00
I have the following JSON object:
var definitionsObject = {company : Some information about company};
This object will actually contain a lot of definitions, not just one. And I also have the following event handler for a link click which has a custom data-name attribute containing the term company:
$(.definitinOpener).click(function() {
$this = $(this);
var hintID = $this.attr(data-name);
var hintText = definitionsObject.hintID;
});
So, what I'm trying to do is get the value of data-name custom attribute of the clicked link, go to the definitionsObject
object and get the value of the field which is equal to the data-name attribute value. However in this way I'm always getting undefined.
Could anybody please help me to figure out what exactly I'm doing wrong?
Thank you beforehand.
More From » jquery