HTML and CSS Reference
In-Depth Information
[ 'January' ,
'February' , 'March' ,
'April' ,
'May' , 'June' , 'July' ,
'August' ,
'September' , 'October' ,
'November' ,
'December' ][ date . getMonth ()] + ' ' +
date . getFullYear ();
return display ;
The code above does the following:
Within the postSuccess function we clear the form values and call displayComment .
displayComment first calls the createComment function to create the list item ( <li> )
HTML as a String .
We then convert the HTML to a jQuery object using $(commentHtml) and hide the
The comment list item is then prepended to the comments ordered list ( <ol> ). The list
also has a class called has-comments added to it so we can hide the first list item which
contains the "Be the first to comment" statement.
Finally, we call commentEl.slideDown() so that the comment is shown in what is
becoming the standard "here's a new item" way.
The functionality is now implemented but we want to test it out. This can be achieved in two
The displayComment is a global function so we can call it directly using the JavaScript
console of the browser.
We can bind to an event on the page that triggers a fake update which calls the
displayComment function
Search WWH ::

Custom Search