w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Working on some Javascript, worked before, changed it, Ctrl+Z'ed it back, stopped working

Correct your input, </input> doesn't exists:

<input type="submit" onclick="getURL()">

You can do what you want like this:

HTML:

<div class="inputField_1">
    <input id="urlInput" type="text"/><br>
    <input type="submit" id="submitUrl"/>
</div>

<div class="aboutTitleWrap"></div>

JQUERY:

$("#submitUrl").on("click", function(){
    var urlInput = $("#urlInput").val();
    var img = new Image();
    img.src = urlInput

    var width = img.width;
    var height = img.height;
    $(".aboutTitleWrap").append("<p>This image has: " + width*height
+ " pixels</p>");
});

JSFIDDLE: http://jsfiddle.net/ghorg12110/8m55r3xq/1/





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.