jQuery

1
2
3
4
5
6
var navList, firstItem, link;
 
navList = $('.nav-list');
firstItem = navList.children().first();
link = firstItem.find('a');
link.attr('href','#');
1
2
3
4
var articleItems;
 
articleItems = $('.article-item');
articleItems.css('font-size','20px');
1
2
3
4
5
6
$('#input').on('change', function(){
  var val;
  var = $('#input').val();
  h1 = $('.articles').children('h1');
  h1.text(val);
});
1
2
3
4
5
var articleItems;
 
articleItems = $('.article-item');
ul = articleItems.find('ul');
ul.remove();
1
2
3
4
5
6
7
8
9
10
11
var family1, family2, bruce, madison, hunter;
 
family1 = $('#family1');
family2 = $('<div id="family2"><h1>Family 2</h1></div>');
bruce = $('<div id="#bruce"><h2>Bruce</h2></div>');
madison = $('<div id="#madison"><h3>Madison</h2></div>');
hunter = $('<div id="#hunter"><h3>Hunter<h3></div>');
  family2.insertAfter(family1);
  family2.append(bruce);
  bruce.append(madison);
  bruce.append(hunter);
1
2
3
4
5
6
7
8
function numberAdder(){
    var text, number;
    text = $(this).text();
    number = text.length;
 
    $(this).text(text + "" + number);
}
$('p').each(numberAdder);
1
2
3
$('#my-input').on('keypress', function(){
  $('button').remove();
});