Init Media Button after htmx Ajax Request

Support General Init Media Button after htmx Ajax Request

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #45461
    cm1cm1
    Participant

    I use the metabox forms in combination with htmx ajax. It works good, but after an ajax request i cant initialize the media button. It´s missing in the ajax response.
    How can i do this?

    Normal Request
    Normal Request

    Ajax Request (Button missing)
    Ajax Request

    Best Regards Thomas

    #45472
    PeterPeter
    Moderator

    Hello,

    The media button is added by the code in the script file wp-content/plugins/meta-box/js/media.js

    if you use Ajax to load the custom field, you need to add the script files along with the Ajax response by using the HTML tag <script>.

    I think you can use the field image to show the HTML5 input field without any script files to prevent that issue.
    https://docs.metabox.io/fields/image/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.