vendredi 22 juillet 2016

jquery conditional button

I have a button that I need to apply a class to if a value retrieved from a database is blank. I think there is something wrong with my syntax in the following code:

$(document).ready(function(e) {
    var videoURL = '<?php echo $row_rs_dealItem['video']; ?>';
    if ($videoURL == "") {
        $('#video').addClass('invisible');
    }
    else {
        $('#video').click(function(e) {
            $('#imageMain').html('<iframe class="youtube-player" type="text/html" width="435" height="244" src="' + videoURL + '" frameborder="0"></iframe>');
            $('.featuredOverlay').hide();
        });
    });
});​

Aucun commentaire:

Enregistrer un commentaire