mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
js: Add new jQuery plugin getData()
This commit is contained in:
parent
9e3c9bbab7
commit
27cd34dd2d
@ -5,6 +5,16 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
/* Get data value or default */
|
||||
$.fn.getData = function (name, fallback) {
|
||||
var value = this.data(name);
|
||||
if (typeof value !== 'undefined') {
|
||||
return value;
|
||||
}
|
||||
|
||||
return fallback;
|
||||
};
|
||||
|
||||
/* Whether a HTML tag has a specific attribute */
|
||||
$.fn.hasAttr = function(name) {
|
||||
// We have inconsistent behaviour across browsers (false VS undef)
|
||||
|
Loading…
x
Reference in New Issue
Block a user