jQuery로 html5 사용자 정의 데이터 속성을 가져 오려고합니다.이 속성은 데이터베이스의 요소로 설정됩니다. 그것들은 html 요소에 삽입되지만 jQuery는 그것을 볼 수 없다.jquery로 html5 데이터 속성을 가져올 수 없습니다.
$("a#modal").on("click",function() {
console.log($(this).data("price"));
});
문제가 무엇인가
<a data-price={{$product->price}} data-brand={{$product->brand . " " . $product->model}} id="model" data-toggle="modal" href="#shoppingcart" class="btn btn-danger btn-sm">Add to Cart</a>
그러나 jQuery로
내가 정의되지 않은 값을 얻을 : 그래서 여기는 사용자 정의 데이터 attrs에 내 HTML 요소인가?
ID는 모달없는 모델입니다. –