I have the following HTML:
<div class="button disabled dialogLink"
id="edit"
data-action="Edit" >
<div class="sprite-blank" ></div>
</div>
This javascript
$('.dialogLink')
.click(function () {
adminDialog(this);
return false;
});
function adminDialog($link) {
"use strict";
link = {
action: $link.data('action') || ''
I get an error saying
Uncaught TypeError: Object #<HTMLDivElement> has no method 'data'
Does anyone have an idea what I am doing wrong. It seems very simple code so I can’t understand what’s wrong.
You should first create a jQuery object for using jQuery object’s methods like
datamethod. You can usedatasetobject:or jQuery
datamethod: