$(document).ready(function() {
ko.validation.init({ errorElementClass: 'has-error', insertMessages : true }); ko.validation.registerExtenders(); var dataUrl = { imgUrl : '/api/advertise/advertisepost' }, loopPictures = $(".loopPictures"), buttons = $(".buttons"), imgYS = loopPictures.find("img"), imgWidth = imgYS.css("width"), imgHeight = imgYS.css("height"), kick = buttons.find("span"); console.log(imgWidth); console.log(imgHeight);
You are getting the style height. If you have not set it in CSS, it will definitely not exist. You can use document.getElementsByClassName("class")[0].offsetHeight to get it,
or directly use jquery $(".class") .height()