EasyUI
Home
Demo
Tutorial
Documentation
Download
Extension
Contact
Forum
EasyUI Forum
April 18, 2024, 01:42:37 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
EasyUI Forum
>
General Category
>
EasyUI for jQuery
>
Open image with easyui-filebox
Pages: [
1
]
« previous
next »
Print
Author
Topic: Open image with easyui-filebox (Read 1793 times)
slavok47
Newbie
Posts: 7
Open image with easyui-filebox
«
on:
June 19, 2022, 05:42:16 AM »
Hello everyone, tell me how to open an image in
Code:
<img id="myImg">
using easyui-filebox, I can’t figure something out
Logged
slavok47
Newbie
Posts: 7
Re: Open image with easyui-filebox
«
Reply #1 on:
June 19, 2022, 10:47:23 AM »
Did this
Code:
$('#addFileBox').filebox({
onChange: function(value){
$('#imagePack').attr('src', value);
}
});
but the problem is that only the file name is indicated, but the full path is needed
Logged
jarry
Administrator
Hero Member
Posts: 2262
Re: Open image with easyui-filebox
«
Reply #2 on:
June 19, 2022, 08:18:47 PM »
Please refer to the code below.
Code:
$('#addFileBox').filebox({
onChange: function(value){
var id = $(this).filebox('options').fileboxId;
var files = $('#'+id)[0].files;
if (files.length){
var url = window.URL.createObjectURL(files[0]);
$('#myImg').attr('src', url);
}
}
})
Logged
slavok47
Newbie
Posts: 7
Re: Open image with easyui-filebox
«
Reply #3 on:
June 20, 2022, 08:11:11 AM »
Thank you, everything works, but only the second time, the first time does not work
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News
=> General Discussion
=> EasyUI for jQuery
=> EasyUI for Angular
=> EasyUI for Vue
=> EasyUI for React
=> Bug Report
Loading...