Ok, I'm being stupid today and can't figure how to get this to work:
I have to set the clock plugin like this:
$('#clock').clock({"calendar":"false", "format":"24","timestamp":"1303996405"});
Where calendar and format I type in manually but the timestamp i collect from the hidden div. And I've tried few stuff like this below:
var timestamp = '{"calendar":"false", "format":"2开发者_StackOverflow4",' + '"timestamp":"' + $('#clockTimestamp').html() + '"}';
alert(timestamp);
$('#clock').clock(timestamp);
But this clearly doesn't work, so please help me out on this one, so I can slap my self in the face for being dumb again :/
edit:This is the correct solution as helped by suhair:
$('#clock').clock({"calendar":"false", "format":"24","timestamp":$('#clockTimestamp').html()*1000});
God bless stackoverflow!!!
Quotes for timestamp not needed. Here is the corrected code demo http://jsfiddle.net/Cd7BX/
Hope this is what you want to accompilsh
Edit: I have pasted the entire plugin code in the fiddle itself that is why the cryptic code at top.
精彩评论