Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var $el = $("<div>", { "data-row-idx": 1, "data-col-idx": 2 })
- // n.fn.init [div]
- $el.data("row-idx")
- // 1
- $el.data("col-idx")
- // 2
- ["row-idx", "col-idx"].map(function(x) { return $el.data(x) })
- // (2) [1, 2]
- ["row-idx", "col-idx"].map($el.data)
- // jquery.min.js:3 Uncaught TypeError: this.each is not a function
- // at data (jquery.min.js:3)
- // at Array.map (<anonymous>)
- // at <anonymous>:1:24
- // data @ jquery.min.js:3
- [1,2,3].map(function(x) { return x})
- // (3) [1, 2, 3]
- ["row-idx", "col-idx"].map(function(x) { return $el.data(x) })
- ["row-idx", "col-idx"].map($el.data)
Add Comment
Please, Sign In to add comment