在的jsfiddle他们有选项来设置no wrap(head)
,no wrap(body)
,OnDomReady
并OnLoad
在左侧的选项.在我的程序中设置no wrap(head)
条件.它的工作很好.但我如何更改为HTML文件.我需要在HTML文件中设置相同的条件
演示:JSFIDDLE
在这里我设置no-wrap(head)
,我如何设置HTML文件的条件相同no-wrap(head)
?
这是我的完整代码
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="a.js"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
google.setOnLoadCallback(drawVisualization);
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['Country', 'Popularity'],
['Germany', 200],
['United States', 300],
['Brazil', 400],
['Canada', 500],
['France', 600],
['Russia', 700]
]);
// this chart is drawn in a visible div and then immediately hidden
var chart1 = new google.visualization.PieChart(document.getElementById('chart_1'));
google.visualization.events.addListener(chart1, 'ready', …
Run Code Online (Sandbox Code Playgroud) 我的HTML页面中有两个表单.validate函数仅处理我的HTML的第一种形式.第二种形式未经过验证.
在这里,我做一个小提琴
这是验证码
$('form').validate({
rules: {
firstname: {
minlength: 3,
maxlength: 15,
required: true
},
lastname: {
minlength: 3,
maxlength: 15,
required: true
}
},
highlight: function(element) {
$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
},
unhighlight: function(element) {
$(element).closest('.form-group').removeClass('has-error').addClass('has-success');
}
});
Run Code Online (Sandbox Code Playgroud) 我试图动态添加一个按钮 - 第一个按钮有效但其他按钮无效.我以前使用过该live
函数,但jQuery 1.9.1删除了该函数.我该怎么做才能让新添加的按钮起作用?
HTML代码:
<div class="take">
<p>this is the para</p>
<button class="test">copy</button>
</div>
Run Code Online (Sandbox Code Playgroud)
jQuery代码:
$('.test').on('click', function() {
var a = $(this).parent();
new.clone().insertAfter(a);
})
Run Code Online (Sandbox Code Playgroud)
这是jsfiddle.