Skip to content Skip to sidebar Skip to footer

JavaScript Image As A Button (onClick)

I'm having a little problem with JavaScript and wondered whether you could help me. I have an image and a video. I want to be able to click the image and to make the video at half

Solution 1:

You have some JavaScript syntax error's in your codes.

$(“#picture_on”)

Don't use multibyte characters as delimiters. Change to " or '. Until using the right syntax, your code is working fine. Check this Fiddle.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
$(document).ready(function(){
    $("#picture_on").click(function(){
        $("#MinecraftVideo").animate({
            opacity: '0.5'
        });
    });
});
</script>

Solution 2:

JavaScript image as a button:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
    $(document).ready(function(){
        $("#picture_on").click(function(){
            $("#MinecraftVideo").animate({
                opacity: '0.5'
            });
        });
    });
</script>

Post a Comment for "JavaScript Image As A Button (onClick)"