Limit filetype and wp media

I have shown your questions and i have found correction in it.

You need to update your code as below.

.on( 'select', function()
{
    var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
    if(attachment.mime == "image/jpg" || attachment.mime == "image/jpge" || attachment.mime == "image/png")
    {

       jQuery( '#previewImage' ).attr( 'src', attachment.url );
       jQuery( '.custom_media_url' ).val( attachment.url );
       jQuery( '.custom_media_id' ).val( attachment.id );
    }
    else
    {
        alert("Please select jpg,jpeg and png type images only");
        custom_uploader.open();
        return;
    }
})

Thanks you!