你好问一下
beforeOpen: function() { console.log('before open callback'); document.getElementById('result').innerHTML == "bbbbb"; },
这里面为啥改变不了P标签里面的内容啊
<script id="J-alert" type="text/html"> <div class="mark"> <div class=" container"> <p style="text-align: center">恭喜你抽中了 <p d="result" style="text-align: center; color: #ff6c8c; font-size: 20px; font-weight: bold">500元优惠券 <div class="commit-bg"> <button id="commit-btn" class="commit-btn" onclick="javascript:commit_action">确认提交</button> </div> </div> <img id="close-alert" src="<%=request.getContextPath()%>/unicorn_aged/activities/luck/img/close_btn.png" class="close-btn"> </div> </script>
function showResult(index) { // alert('恭喜你中了第'+ index +'个') var instance = null; $('#luck').delegate('.cjBtn', 'auto', function(e) { var type = $(this).attr('data-type'); instance = $(this).slideAlert({ type: type, content: $('#J-' + type).html(), beforeOpen: function() { console.log('before open callback'); }, afterClose: function() { console.log('after close callback'); }, afterOpen: function() { console.log('after open callback'); }, shadeClose: true, time: $(this).attr('data-time') }); }); $('#J-close-tips').on('click', function(e) { instance.closeTips() }) }
我是封到方法里了 但是怎么都不出来
<div id="bottom" class="bottomBg"> <div class="shanDeng" id="deng"> <div id="luck"> <!-- luck --> <table> <tr> <td class="luck-unit luck-unit-0"><img src="./img/1.png" class="prize"></td> <td class="luck-unit luck-unit-1"><img src="./img/2.png" class="prize"></td> <td class="luck-unit luck-unit-2"><img src="./img/3.png" class="prize"></td> </tr> <tr> <td class="luck-unit luck-unit-7"><img src="./img/6.png" class="prize"></td> <td class="cjBtn" id="btn" data-type="alert"></td> <td class="luck-unit luck-unit-3"><img src="./img/5.png" class="prize"></td> </tr> <tr> <td class="luck-unit luck-unit-6"><img src="./img/3.png" class="prize"></td> <td class="luck-unit luck-unit-5"><img src="./img/4.png" class="prize"></td> <td class="luck-unit luck-unit-4"><img src="./img/8.png" class="prize"></td> </tr> </table> </div> <!-- luckEnd --> </div> </div>
function showResult(index) { // alert('恭喜你中了第'+ index +'个') var instance = $(this).slideAlert({ type: type, content: $el.html(), beforeOpen: function() { console.log('before open callback'); }, afterClose: function() { console.log('after close callback'); }, afterOpen: function() { console.log('after open callback'); }, shadeClose: true, time: $(this).attr('data-time') }); }
这样写调方法就能出来了
prizeList.html?_ijt=8dv5qkqj6glpp633q0jqrbs64a:127 Uncaught TypeError: $(...).slideAlert is not a function at HTMLButtonElement.<anonymous> (prizeList.html?_ijt=8dv5qkqj6glpp633q0jqrbs64a:127) at HTMLDivElement.l (zepto.min.js:2) at HTMLDivElement.a.proxy (zepto.min.js:2)
咋回事啊这是