jQuery event listener not working on multiple elements?
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
const date = document.getElementById(“date”);
const time = document.getElementById(“time”);
const d_t = document.getElementById(“showDate-Time”);
$(document).ready(function () {
$(“#date”).change(function () {
d_t.innerHTML = `${date.value} ${time.value}`;
});
$(“#time”).change(function () {
d_t.innerHTML = `${date.value} ${time.value}`;
});
});
Whenever I change the date value the function gets called but when I change the time value it does’t get called. If I switch their order only the first one gets triggered.
أضف إجابة