function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
// apply the currently selected filter to the new image
jQuery('#blah').attr('src', e.target.result).filterMe();
jQuery('#preview').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
jQuery("#imgInp").change(function(){
readURL(this);
});
jQuery("#filter").change(function() {
var filterName = jQuery('#filter').find(":selected").text();
var src = jQuery('#preview').attr('src');
jQuery("#blah")
.removeData() // when you restore the original image, you need to remove the stored data object too.
.attr({ "src": src, "data-filter": filterName })
.filterMe();
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.