php - Wordpress Media Library in plain javascript


I'm working with wordpress and I'm creating a theme for myself. I want to use the wordpress media library in the admin panel. So after some searching I found this page:

There are multiple tutorials to add this media library with jQuery, but I would like to do it in a plain javascript way. I've no trouble converting the jQuery to javascript except this piece of code:

// When an image is selected in the media frame...
    frame.on( 'select', function() {
        // Removed unrelevant code

Ive tried the following things: = function(){};
frame.onselect = function(){};

None of them are working, I get an error on the last one:

frame.addEventListener is not a function

So I hope I can get some help from here. I love everyone trying to help, but I don't want to hear: "use jQuery". The choice for not using jQuery is one I made on purpose.


People are also looking for solutions to the problem: oracle select with php won't show


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.