Jquery noConflict()
<!DOCTYPE html>
<html lang="en">
<head>
<title>Jquery noConflict Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
var jQuery190 = $.noConflict(); // $ ==> shorthand of Jquery
</script>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
var jQuery1111 = jQuery.noConflict();
</script>
<script src="https://code.jquery.com/jquery-1.6.2.js"></script>
<script>
var jQuery1113 = jQuery.noConflict();
</script>
</head>
<body>
<div class="container" style="margin-top:80px;">
<input type="button" value="Jquery3.3.1" id='btn190' />
<input type="button" value="jquery-1.10.2" id='btn1111' />
<input type="button" value="jquery-1.6.2" id='btn1113' />
</div>
<script>
jQuery190(document).ready(function($) {
//The codes for jQuery 3-3-1
$("#btn190").click(function() {
alert($.fn.jquery);
})
});
jQuery1111(document).ready(function($) {
//The codes for jQuery 1-1-0
$("#btn1111").click(function() {
alert($.fn.jquery);
})
});
jQuery1113(document).ready(function($) {
//The codes for jQuery 1-6-2
$("#btn1113").click(function() {
alert($.fn.jquery);
})
});
</script>
</body>
</html>
Comments
Post a Comment