jQuery .prop() returns undefined, while .attr() works as expected for data-*
问题 I am simply trying to get a couple of properties from two elements. Getting the property value from the input element works as expected. The problem is with getting the property data-detail property from the button element. It returns undefined when using .prop() , but works as expected when using .attr() . Can anyone explain this odd behaviour I am witnessing? HTML <div class="formRow"> <label for="firstName">First name</label> <div class="detailsControlBtns"> <button id="editFirstName"