Brigitte Brigitte - 1 month ago 5
Javascript Question

Change .text() of a div not working

I cannot get jquery to change the text of a div. I have gotten the code to work on jfiddle but on the live site it is not being detected. I have even tried to add the function to (document) click so it ensure the function runs.

$(document).click( function () {
var ptime = $('#vaptimelineblock0').text();
if (ptime == "07:00 PM") {
$('#vaptimelineblock0').text("7:15 pm");
}
});


The live project is located

http://ecofreshdrycleaners.com/component/vikappointments/?view=servicesearch&id_ser=2

EDIT:
Here is the jfiddle working

https://jsfiddle.net/cts5bfud/

Answer

As already said in comments you need to fix error Uncaught TypeError: Cannot set property 'value' of null

Cause of that error is this code:

document.getElementById("couponkey").value=document.getElementById("couponcode").innerHTML;

You don't have element with id 'couponkey'.
Remove this code and it all works fine (or set element with that id properly).