Skip to content

Commit

Permalink
Day 44: JQUery
Browse files Browse the repository at this point in the history
  • Loading branch information
uttu-316 committed Nov 30, 2022
1 parent 134c224 commit 85512e3
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
33 changes: 33 additions & 0 deletions javascript/Day44/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script
src="https://code.jquery.com/jquery-3.6.1.js"
integrity="sha256-3zlB5s2uwoUzrXK3BT7AX3FyvojsraNFxCc2vC/7pNI="
crossorigin="anonymous"
></script>
</head>
<body>
<h1>Welcome to Jquery</h1>

<p>Paragraph 1</p>
<p class="para">Paragraph 2</p>
<p>Paragraph 3</p>
<p class="para">Paragraph 4</p>
<p>Paragraph 5</p>

<ul>
<li>Ahemad</li>
<li>Ajay</li>
<li>Sunidhi</li>
<li>Sachin</li>
<li>Praveen</li>
</ul>
<table></table>
<script src="./script.js"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions javascript/Day44/prototype.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
let arr =[1,2,3,4,5,6];


Array.prototype.getEvens = function(){
const array = this;
const evenArray =[];

for(let i=0;i<array.length;i++){
if(array[i]%2==0){
evenArray.push(array[i])
}
}
return evenArray

};

console.log(arr.getEvens())
console.log([10,12,34,43,77,9,89].getEvens())
58 changes: 58 additions & 0 deletions javascript/Day44/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
$(document).ready(() => {
// $('.class #id')
//document.querySelectorAll('.class #id')

const allP = $(".para");
console.log(allP);

const first = $("p:first");
console.log(first);

const last = $("p:last");
console.log(last);

const firstEl = $("p").first();
console.log(firstEl);

const lastEl = $("ul li").last();
console.log(lastEl);

const firstIndex = $("ul li").eq(1);
console.log(firstIndex);

const el = $("ul li").eq(0);
console.log(el);
});

$(() => {
console.log("I am Ready");
const ulContent = $("ul").html();
const heading = $("h1").html();
const li = $("ul li:first").text();
console.log(li);

setTimeout(() => {
$("h1").html("Hello It is jQuery");
}, 2000);

const newLi = $("<li>Utkarsh</li>");

$("ul").append(newLi);

const table = $("table");

const newRow = `
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Utkarsh</td>
<td>23</td>
</tr>
`;
const tr = $(newRow);

table.append(tr);
});

0 comments on commit 85512e3

Please sign in to comment.