Title: Long standing Javascript problem
Last modified: September 15, 2023

---

# Long standing Javascript problem

 *  Resolved [therealgilles](https://wordpress.org/support/users/chamois_blanc/)
 * (@chamois_blanc)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/long-standing-javascript-problem/)
 * I see this admin-only JS issue on a regular basis. It would be great to get it
   fixed. Thank you 🙂
 *     ```wp-block-code
       TypeError Cannot read properties of undefined (reading 'indexOf')
   
       (Most recent call first)
       at
       toggleCategorySelection(.../wp-content/plugins/post-expirator/assets/js/expirator-classic-editor.js:16:29)
       at
       init(.../wp-content/plugins/post-expirator/assets/js/expirator-classic-editor.js:27:9)
       at
       HTMLDocument.<anonymous>(.../wp-content/plugins/post-expirator/assets/js/expirator-classic-editor.js:7:9)
       at
       e(.../wp-admin/load-scripts.php:2:26990)
       at
       t(.../wp-admin/load-scripts.php:2:27292)
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Support [Riza Maulana Ardiyanto](https://wordpress.org/support/users/rizaardiyanto/)
 * (@rizaardiyanto)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/long-standing-javascript-problem/#post-17053232)
 * Hi [@chamois_blanc](https://wordpress.org/support/users/chamois_blanc/)
 * Thanks for using PublishPress Future.
 * Do you mind informing us how to replicate the issue? We did not see this error
   on our testing.
 *  Plugin Support [Riza Maulana Ardiyanto](https://wordpress.org/support/users/rizaardiyanto/)
 * (@rizaardiyanto)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/long-standing-javascript-problem/#post-17077154)
 * We haven’t heard back from you in a while, so I’m going to mark this as resolved.
   If you have any further questions, please reply again here, or you can start 
   a new thread.
 * Thanks,
 *  Thread Starter [therealgilles](https://wordpress.org/support/users/chamois_blanc/)
 * (@chamois_blanc)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/long-standing-javascript-problem/#post-17090794)
 * Apologies for not replying sooner. I do not exactly know how to replicate the
   issue but the JS error should make it easy enough to fix this bug.
 * I see this error in Rollbar. And from the error message, it happens when using
   the classic editor.
 * The fix should be straightforward as follows:
 *     ```wp-block-code
       -        if ($(element).val().indexOf('category') !== -1) {
       +        if ($(element).val()?.indexOf('category') !== -1) {
       ```
   
 * It’s pretty clear from the documentation that `val()` can return `undefined`:
 * > The `.val()` method is primarily used to get the values of form elements such
   > as `input`, `select` and `textarea`. When called on an empty collection, it
   > returns `undefined`.
    -  This reply was modified 2 years, 8 months ago by [therealgilles](https://wordpress.org/support/users/chamois_blanc/).
 *  Plugin Author [andergmartins](https://wordpress.org/support/users/andergmartins/)
 * (@andergmartins)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/long-standing-javascript-problem/#post-17093887)
 * Hi [@chamois_blanc](https://wordpress.org/support/users/chamois_blanc/),
 * Thanks for the feedback and for suggesting a fix. 
   We already implemented a fix
   for this which is planned to be released this week.
 * Thanks
 *  Thread Starter [therealgilles](https://wordpress.org/support/users/chamois_blanc/)
 * (@chamois_blanc)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/long-standing-javascript-problem/#post-17095068)
 * Much appreciated!
 *  Thread Starter [therealgilles](https://wordpress.org/support/users/chamois_blanc/)
 * (@chamois_blanc)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/long-standing-javascript-problem/#post-17212609)
 * Hi [@andergmartins](https://wordpress.org/support/users/andergmartins/), this
   is still not fixed. What happened?
 *  Plugin Support [Riza Maulana Ardiyanto](https://wordpress.org/support/users/rizaardiyanto/)
 * (@rizaardiyanto)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/long-standing-javascript-problem/#post-17215921)
 * Hi [@chamois_blanc](https://wordpress.org/support/users/chamois_blanc/)
 * Apologies for the delay; we couldn’t include this in the previous release. However,
   our goal is to incorporate it in version 3.1.4.
 * For more details, you can refer to the GitHub issue here: [https://github.com/publishpress/PublishPress-Future/issues/542](https://github.com/publishpress/PublishPress-Future/issues/542)

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Long standing Javascript problem’ is closed to new replies.

 * ![](https://ps.w.org/post-expirator/assets/icon-256x256.png?rev=3569472)
 * [Schedule Post Changes With PublishPress Future: Unpublish, Delete, Change Status, Trash, Change Categories](https://wordpress.org/plugins/post-expirator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-expirator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-expirator/)
 * [Active Topics](https://wordpress.org/support/plugin/post-expirator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-expirator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-expirator/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [Riza Maulana Ardiyanto](https://wordpress.org/support/users/rizaardiyanto/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/long-standing-javascript-problem/#post-17215921)
 * Status: resolved