问题
![enter image description here][1] Hi I am getting server data from web socket but i am facing one problem that i need to show current time in the from to front of web service data as show ..I am able to show data but time is not in front of that..:(
How to show time in front of data.
I am using like this
function nativePluginResultHandler (result)
{
$('#realTimeContents' ).append('<p>'+result+'</p>');
}


回答1:
From this answer: How to get current time in jquery mobile or jquery
Why wouldn't taking your server's appended results and then prepending with the javascript time stamp work?
$('#time').prepend("<b>" + hours + ":" + minutes + " " + "</b>");
回答2:
Try something like this:
function date() {
var now = new Date(),
now = now.getHours()+':'+now.getMinutes()+':'+now.getSeconds();
$('#time').html(now);
}
Fiddle: http://jsfiddle.net/u32pU/2/
来源:https://stackoverflow.com/questions/17881261/how-to-show-time-in-front-of-web-service-data-in-jquery-mobile