Title: [Plugin: Javascript Chat for WordPress] Javascript Chat Plutin Fixes (autoscroll, date/time)
Last modified: August 20, 2016

---

# [Plugin: Javascript Chat for WordPress] Javascript Chat Plutin Fixes (autoscroll, date/time)

 *  [nitrous26](https://wordpress.org/support/users/nitrous26/)
 * (@nitrous26)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-javascript-chat-for-wordpress-javascript-chat-plutin-fixes-autoscroll-datetime/)
 * This is really a great, lightweight chat plugin and it deserves more credit. 
   I’ve modified it a bit to suit my site’s needs and I’ll share a couple of fixes.
 * Autoscrolling the box was built in, but broke with newer versions of wordpress
   with jquery 1.6 and above. To fix this, edit the /javascript/wp_jschat.js file
   and change line 29 to:
    `t.find('.wp_jschat_widget_text').prop({scrollTop: t.
   find('.wp_jschat_widget_text').prop('scrollHeight')});` the “attr” tag is depreciated
   and “prop” replaces the functionality.
 * To make it really fancy, you can stick in the animate function to make it slowly
   scroll and look like you paid money for the plugin or something by replacing 
   line 29 with this:
    `t.find('.wp_jschat_widget_text').animate({scrollTop: t.find('.
   wp_jschat_widget_text').prop('scrollHeight')}, 3000);`
 * To add in a time and date(just as part of the message, not grabbing from the 
   db… cause I’m lazy), change the submit function on about line 49-78 to this:
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * Hope this helps…
 * [http://wordpress.org/extend/plugins/javascript-chat-for-wordpress/](http://wordpress.org/extend/plugins/javascript-chat-for-wordpress/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [nitrous26](https://wordpress.org/support/users/nitrous26/)
 * (@nitrous26)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-javascript-chat-for-wordpress-javascript-chat-plutin-fixes-autoscroll-datetime/#post-2593022)
 * …Too many lines of code, it got moderated out. Here’s the date code again.
 * In the submit function after these lines:
 *     ```
       jQuery('.wp_jschat_widget_form').submit(function(){
               var t = jQuery(this);
               var obj = {};
       ```
   
 * add this:
 *     ```
       var currentDate = new Date();var day = currentDate.getDate();var month = currentDate.getMonth() + 1;var year = currentDate.getFullYear();var hours = currentDate.getHours();var minutes = currentDate.getMinutes();
       if(minutes<10){	obj.wp_jschat_text = ' '+month+'/'+day+'/'+year+' '+hours+":0"+minutes+' : '+t.find('.wp_jschat_text').val(); }
       else{ obj.wp_jschat_text = ' '+month+'/'+day+'/'+year+' '+hours+":"+minutes+' : '+t.find('.wp_jschat_text').val(); }
       ```
   
 * and delete this line:
    `obj.wp_jschat_text = t.find('.wp_jschat_text').val();`

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Javascript Chat for WordPress] Javascript Chat Plutin Fixes (
autoscroll, date/time)’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/javascript-chat-for-wordpress.svg)
 * [Javascript Chat for Wordpress](https://wordpress.org/plugins/javascript-chat-for-wordpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/javascript-chat-for-wordpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/javascript-chat-for-wordpress/)
 * [Active Topics](https://wordpress.org/support/plugin/javascript-chat-for-wordpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/javascript-chat-for-wordpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/javascript-chat-for-wordpress/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [nitrous26](https://wordpress.org/support/users/nitrous26/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-javascript-chat-for-wordpress-javascript-chat-plutin-fixes-autoscroll-datetime/#post-2593022)
 * Status: not a support question