WordPress.org

Ready to get started?Download WordPress

Forums

Meta Box
[resolved] time field js wont run without datetime (3 posts)

  1. fiskhandlarn
    Member
    Posted 1 year ago #

    When I took the demo code (from demo/demo.php) and removed all fields except the time field, the jquery-ui-timepicker stopped working. It seemed that I only got it to work again if I also included a datetime field as well.

    The problem seems to be that js/time.js is looking for $( '.rwmb-time' ), but inc/fields/time.php sets the class rwmb-datetime for all time fields (on line 40). A change to this will do the trick:
    '<input type="text" class="rwmb-time" name="%s" value="%s" id="%s" size="%s" data-options="%s" />',

    Also, may I suggest changing line 15 in js/time.js to this?
    $this.removeClass( 'hasDatepicker' ).timepicker( options );
    (That way the options doesn't have to be normalized with timeOnly set to false.)

    I found this issue both in 4.2 and 4.2.1.
    Thanks for all your hard work!

    http://wordpress.org/extend/plugins/meta-box/

  2. rilwis
    Member
    Plugin Author

    Posted 1 year ago #

    Very nice! Thanks. I'll check this and update.

  3. fiskhandlarn
    Member
    Posted 1 year ago #

    Fixed in the latest update, thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic