I am using the jQuery plugin TagManager. I am having trouble dealing with empty arrays when the form gets initialized and I cant figure out why. Here is my script;
$(".tm-input").each(function() {
var e, l;
e = $(this);
l = e.data("load");
e.tagsManager({
prefilled: $.isEmptyObject(l) ? null : l
});
});
I set the data attribute data-load to the value I want to display.
The prefilled option is supposed to get set to null if l is empty and it's not working.
If I break at the prefilled line above, the l variable value is Array[0]. If I check $.isEmptyObject(l) ? null : l it returns null, but the value that gets displayed is "[]". When the data-load value is null it works correctly.
Here is the affected form html;
<input class="tm-input" data-load="[]" placeholder="enter tags here" value="[]" type="text"></input>
Can someone help me figure out what's going on?
lis likely the string"[]".$.isEmptyObject([]) == true