Brigitte Brigitte - 1 year ago 60
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

Here is the jfiddle working

Answer Source

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:


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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download