这些是我的项目的 js 文件:
tablequerywrapper.js
gauge.min.js
Functions.js
colortip-1.0-jquery.js
ObjectivesFunctions.js
jquery.bxslider.js
在:Functions.js
,我有:
$('li div[id^="objective_option_conversion_points_"]').click(function () {
alert('3');
}
$('#sortedPixels tbody').sortable({
items: '> tr',
forcePlaceholderSize: true,
placeholder: 'must-have-class',
start: function (event, ui) {
// Build a placeholder cell that spans all the cells in the row
var cellCount = 0;
$('td, th', ui.helper).each(function () {
// For each TD or TH try and get it's colspan attribute, and add that or 1 to the total
var colspan = 1;
var colspanAttr = $(this).attr('colspan');
if (colspanAttr > 1) {
colspan = colspanAttr;
}
cellCount += colspan;
});
// Add the placeholder UI - note that this is the item's content, so TD rather thanTR
ui.placeholder.html('<td colspan="' + cellCount + '"> </td>');
}
}).disableSelection();
我运行它并得到:
Uncaught TypeError: Object #<Object> has no method 'sortable'
我读到这个错误是因为我需要JQUERY UI
,所以我补充说:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
并且错误消失了。但是当我按下一个 id = "objective_option_conversion_points_1" 的 div 时,什么也没发生。
所以我尝试了:
$('li div[id^="objective_option_conversion_points_"]').on('click', function () {
alert('3');
}
但什么也没发生。
所以我尝试了:
$('li div[id^="objective_option_conversion_points_"]').live('click', function () {
alert('3');
}
但后来我又遇到了另一个错误:
Uncaught TypeError: Object [object Object] has no method 'live'
请问我该如何解决?
ps
在我的 jsfiddle 中,它有效:
http://jsfiddle.net/alonshmiel/adpFV/7/
任何帮助表示赞赏!