Как присвоить объекту jquery "левый аттрибут"
Допустим, я создаю объект
ex = $('<div></div>');
//это "левый" аттрибут
ex.type = 'type1';
$('#container').append(ex);
Потом при обходе всех детей:
$('#container').children('div').each(function () {
ex = $(this);
data[ex.attr('id')] = {
'type': ex.type,
}
});
почему то нету ex.type - undefined Как мне задать внешний "левый" аттрибут ? Это вообще возможно ? |
var ex = $("<div></div>").data("type", "type1");
$('#container').append(ex);
$('#container div').each(function () {
ex = $(this);
data[ex.attr("id")] = {
type: ex.data("type")
};
});
http://docs.jquery.com/Core/data |
Благодарю, Octane!
|
| Часовой пояс GMT +3, время: 14:18. |