我正在使用knockout js自定义绑定,并且我生成自动索引值以生成其工作正常的唯一ID,但我需要在我的自定义绑定中获取该ID值,如何实现此功能我无法做到这一点需要帮助
//this div is inside the for each loop
before page load
<div data-bind="myFavouriteItem:({Favitem:someitem}),attr: { id: 'Fav_' + $index() }" class="fav"></div>
after page load get data and ID is generated dynamically
<div data-bind="myFavouriteItem:({Favitem:someitem}),attr: { id: 'Fav_' + $index() }" class="fav" id="Fav_0"></div>
//custom Binding handler
ko.bindingHandlers.myFavouriteItem= {
update: function (element, valueAccessor) {
//inside the consloe.log(element) i am getting above div with ID "Fav_0"
//here i need to get the attr ID value
}