I have a script that copies the text from an image’s ALT-text and makes a caption box, and inputs the text.
var alt = $("#hoejre p span img").attr("alt");
$('#hoejre p span img').after('<span></span>');
$('#hoejre p span span').html('<strong>' + alt.replace('-', '</strong> <em>') + '</em>');
This works great, when there IS an image. But when there aren’t any images, the script fails in IE7.
How can I wrap the VAR with an IF sentence.
why call a method when you could just look at length property?