I have a " span " with date properties:
<span data-label="Name" data-icon="user"></span>
And in the script I have a variable with objects:
var widgets = {
options: {
label: null,
icon: null
}
};
How can I search and by the date values within the objects ???
edição
I tried for how you are in the question to facilitate, but apparently complicated more. I apologize kkkkk
But this is what I'm looking forward to creating " widgets " that performs your roles according to the " data-role " provided, then performs the respective function , with some options that can give more information that in the case are other " date -... ", follow the code:
$.widget = function(name, parameters){
$(document).ready(function(){
var widgets = $("[data-role=" + name + "]");
Object.keys(parameters.options).forEach(function(key){
parameters.options[key] = widgets.data(key);
});
parameters._create(widgets);
});
};
var widget = $.widget;
$.widget("input", {
options: {
label: null,
icon: null
},
_create: function(element){
var o = this.options;
$("<span/>").addClass("label fg-" + _theme_featured).text(o.label).appendTo(element);
But it just collects data from the first and adds in all, I would like it to be individual