I have a jQuery slideshow that displays a caption over each slide by taking the text from the image's alt and title text. The only problem is I don't want it to display the caption at all when an image in the slideshow doesn't have a title/alt.
See the example code here: http://jsfiddle.net/MCdyC/
I know I need to have an IF statement test to see if the image title/alt is blank, but nothing I try has worked.
Try something along the lines of:
var title = $('.showimage').attr('title');
var alt = $('.showimage').attr('alt');
if (typeof title !== 'undefined' && title !== false && typeof alt !== 'undefined' && alt !== false) {
// WRAP YOUR WHOLE FUNCTION IN HERE
} else {
// WRAP YOUR WHOLE FUNCTION IN HERE WITHOUT THE SHOW CAPTION FUNCTION
}