首页 > 解决方案 > 使用 jquery 从数据集中获取值

问题描述

当我控制台事件的值以这种类型显示数据时,我正在使用可放置事件:-

 console.log('event-d--', event.target.childNodes[4]);
 this is result
 dataset:DOMStringMap {sectionvalue: "599a974a7c086869cba64435"}

但是当我得到数据时,这里显示未定义的是我的代码:-

 console.log('event-d--', event.target.childNodes[4].dataset["sectionValue"]);

它显示未定义,我也试过这个: -

console.log('event-d--', event.target.childNodes[4].dataset["sectionvalue"]);
console.log('event-d--', event.target.childNodes[4].dataset.sectionvalue);

但没有运气,这是我的 HTML 代码:-

   <td  *ngFor="let doctor of calendarUsers" style="width:10%; border-right: 1px solid #eee;">
    <ul id="{{doctor.id}}" class="connectedSortable">
        <li *ngFor="let calendarAppointment of calendarAppointments | filterBy: {resourceId : doctor.id}" class="ui-state-default"
         attr.data-sectionvalue="{{doctor.id}}"  ></li>
    </ul>
   </td>

标签: jqueryjquery-uiangular2-routing

解决方案


推荐阅读