How do I add a value to the data- of jquery?

I want to send the value to the data- series

attr("data-discount_id", response.discount_id)

but I find that there is no way to do it.
make sure the response.discount_id has a value
is there any way to enter the value?


$dom.attr('data-discount_id', response.discount_id)
//
$dom.data('discount_id', response.discount_id)
Menu