Create flip toggle from code
===

I`m trying to create flip toggle from code.

    var favFlip = '<label for="favourFlip">To fav:</label>'+
            '<select id="favourFlip" data-role="slider">'+
                '<option value="off">Off</option>'+
                '<option value="on">On</option>'+
            '</select>';
            $('.ui-content').append(favFlip);
    var flip = $('#favourFlip');
    flip.slider('refresh');

This code work in `pagebeforeshow` handler and throw error: `Uncaught cannot call methods on slider prior to initialization; attempted to call method 'refresh' `. How fix it?