css - Jquery click event hides div -


I'm trying to refresh the date of a div and I'm not sure if clicking on refresh Why the divas disappear. How can I refresh the date when I click on the div? Jquery code var monthId = (new date) .getMonth (); Var dayNo = (new date) .getDate (); Var monthName = GetMonthFullName (Month ID); Var hours = new date (). GetHours (); Var min = new date (). GetMinutes (); Var seconds = new date (). GetSeconds (); Var order date = month name + "" + day + + "," + hours + ":" + minute + ":" + sec; Festival, "July", "June", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November December"] ; Return month [month number -1]} $ ('# time-time'). Text (order date); $ ('#Refresh Details'). Click (function () {$ ('# datetime'). Text (order date); $ ("# detailsRefreshCont"). Load (location.href + "#detailsRefreshCont>; *");}); HTML code and lieutenant; Div class = "linkText" id = "detailsRefreshCont" & gt; & Lt; Span id = "datetime" & gt; & Lt; / Span & gt; & Lt; Span class = "linkText" id = "refreshDetails" & gt; Refresh & lt; / Span & gt; & Lt; / Div & gt;

There is no need to use .load (), try < / p>

  // Logic to a function so that it can restart the function getTime () {var monthId = (new date) .getMonth (); Var dayNo = (new date) .getDate (); Var monthName = GetMonthFullName (Month ID); Var hours = new date (). GetHours (); Var min = new date (). GetMinutes (); Var seconds = New date (). GetSeconds (); Month of Return + "" + Day + No + "," + hours + ":" + minutes + ":" + sec; } "Milan", "June", "July", "August", "September", "October", "November December"]; Return months [month number - 1]} $ ('# time') Text (getTime ()); $ ('# RefreshDetails') Click (function () {// there is no need to use the load in it, just call the function that gives $$ ('# datetime'). Text (getTime ());});   

Demo:

In your case, you are trying to reload the contents of the container element, which fails in this type of information about the element The code is empty.

Comments

Popular posts from this blog

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -