Ali_dotNet Ali_dotNet - 7 months ago 30
Javascript Question

change image opacity using javascript

how can I change image opacity using javascript? I'm going to create a fading effect using javascript, is there any sample? is there anything like image.opacity that can be changed through JS code? how is it set?



Supposing you're using plain JS (see other answers for jQuery), to change an element's opacity, write:

var element = document.getElementById('id'); = "0.9";  = 'alpha(opacity=90)'; // IE fallback