i am using this query in my plugin to uploading media file , when i keep it file in wp_enqueue_script it working properly except after i select the image , this code does not return on wordpress page. $ content .='<div class="col-sm-6">'; $ content .='<label class="fo">Upload Image</label>'; $ content .='<input type="button" type="button" name="txt_image"id="txt_image" class="form-control"style=" font: italic bold 12px/30px Georgia, serif;font-size:20px;" value="Upload Image">'; $ content .='<img src="" id="getImage" style="height:100px;width:100px;"/>'; $ content .='<input type="hidden" name="student_image" id="student_image"/>'; $ content .='</div>'; <script> jQuery(document).on("click","#txt_image",function(){ var image = wp.media({ title:"Upload Image", multiple:false }).open().on("select", function(e){ var uploaded_image = image.state().get("selection").first(); var image_data = uploaded_image.toJSON(); jQuery("#getImage").attr("src", image_data.url); jQuery("#student_image").val(image_data.url); }); }); </script>