在下面的代码中,当我单击“投票”时,会显示投票结果屏幕,但是当我单击“返回投票”时,投票会重新显示,但“显示选项”按钮不再可见。单击“返回投票”时,是否有办法防止隐藏此按钮。
这是小提琴:http: //jsfiddle.net/E2gku/2/
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/5968383.js"></script>
<noscript><a href="http://polldaddy.com/poll/5968383/">This is a test question ?</a></noscript>
<style>
.pds-pd-link {
display: none !important;
}
.pds-box {
width: 200px !important;
}
.pds-input-label{
width: auto! important;
}
.PDS_Poll{
margin-bottom:15px;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$('.pds-question').append('<input type="button" class="showanswer" value="Show Options"/>');
$('.pds-vote').css('display' , 'none');
$('.pds-answer').css('display' , 'none');
$('.pds-vote-button').css('display' , 'none');
$('.pds-view-results').css('display' , 'none');
$('.showanswer').on('click', function () {
$('.pds-vote').show();
$('.pds-answer').show();
$('.pds-vote-button').show();
$('.pds-view-results').show();
$('.showanswer').hide();
$('.pds-question').append('<input type="button" class="hideanswer" value="Hide Options"/>');
$('.hideanswer').on('click', function () {
$('.pds-vote').hide();
$('.pds-answer').hide();
$('.pds-vote-button').hide();
$('.pds-view-results').hide();
$('.showanswer').show();
$('.hideanswer').hide();
});
});
});
</script>