Jquery
Jquery
Jquery::
=============
jQuery is a fast, lightweight JavaScript library designed to simplify HTML document traversal,
manipulation, event handling, and AJAX interactions. It provides a simplified and efficient way to write
JavaScript code that works seamlessly across different web browsers.
Code:
===================
index.html
===================
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Tutorial</title>
</head>
<body>
<p>this is my body4</p>
<div id='wiki'>
Code With Harry(1770–3854)
</div>
<form>
</form>
</body>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/myjQuery.js"></script>
</html>
=============
myjQuery.js
=============
$(document).ready(function () {
// $('selector').action()
//clicks on all the p elements.
// $('p').click(); //click on p
// $('p').click(function () {
// // $('#id').hide();
// // $('.class').hide();
// $('p').dblclick(function () {
// // $('#id').hide();
// // $('.class').hide();
// });
// $('p').hover(function () {
// // $('#id').hide();
// // $('.class').hide();
// },
// function (){
// });
// 1. element selector
// 2. id selector
// 3. class selector
// 1. Element selector - This is an example of element selector which clicks on all p
// $('p').click();
// $('#second').click();
// $('.odd').click();
// other selectors
// Events in jQuery
$('p').on(
click: function () {
},
mouseleave: function () {
console.log("mouseleave");
}
})
// $('#wiki').hide(1000, function () {
// console.log("hidden");
// })
// $('#wiki').show(1000, function () {
// console.log("show");
// })
$('#but').click(function () {
$('#wiki').fadeOut(5000);
})
// fadeIn()
// fadeOut()
// fadeToggle()
// fadeTo()
// $('#wiki').slideUp(1000, function(){
// console.log('done');
// })
// $('#wiki').slideDown(1000)
// $('#wiki').slideToggle(1000)
// Animate function in jQuery
// $('#wiki').animate({
// opacity:0.3,
// height: '150px',
// width:'350px'
// }, "fast")
// $('#ta').val('setting it to harry');
// $('#ta').html('setting it to harry');
// $('#ta').html('setting it to harry3');
// $('#inp').html('setting it to harry3');
// $('#inp').val('setting it to harry3');
// $('#inp').empty()
// $('#wiki').empty()
// $('#wiki').remove()
// $('#wiki').addClass('myclass')
// $('#wiki').addClass('myclass2')
// $('#wiki').removeClass('myclass2')
// $('#wiki').css('background-color', 'red')
// $('#wiki').css('background-color')
// $.post('https://code.jquery.com/jquery-3.3.1.js',
});