I'm trying to retrieve the offsetHeight of a server-side control but it gives me an error. Here's the following code snippet -
function Test() {
var imgFavorite = $("<%= imgFavorite.ClientID %>"); //imgFavorite is a server-side asp:Image control.
alert(imgFavorite); //[object Object]
alert(imgFavorite.offsetHeight()); //undefined.
}
What is wrong with the code?
You've missed the hash when declaring the jQuery object using an ID:
var imgFavorite = $("#<%= imgFavorite.ClientID %>");