LinkedIn jQuery Skills Assessment Test Answers 2022

Access database practice test, access skills test, How to Pass Microsoft Access Test, LinkedIn Angularjs Assessment Test Answers 2022, LinkedIn Microsoft Access Assessment Answers 2022- LinkedIn Microsoft Access Skill Quiz, Linkedin Microsoft Access Quiz Answers, Linkedin Microsoft Access Skill Assessment Test, Linkedin Microsoft Access Test Answers, LinkedIn Node JS Assessment Test Answers 2022- LinkedIn Node JS Skill Assessment Quiz, LinkedIn OOP Assessment Test Answers 2022, LinkedIn OOP Assessment Test Answers 2022 - Object Oriented Programming Assessment LinkedIn Test Answers 2022, LinkedIn Visio Assessment Test Answers 2022, Microsoft Access assessment LinkedIn, Microsoft Access Assessment Test, Microsoft access practice exam pdf, Microsoft access skills, Microsoft access test questions and answers, Microsoft access test Quizlet, ms access exam questions and answers pdf, Test Answers 2022
Spread the love

LinkedIn jQuery Skills Assessment Test Answers 2022 : Are you Looking for LinkedIn jQuery Skills Assessment Test Answers 2022 Today in This article i will show You LinkedIn jQuery Skills Assessment Test Answers 2022, Linkedin Ruby on Rails Test Answers,How to Pass Ruby on Rails Test?,Linkedin Ruby on Rails Assessment.

How to Pass LinkedIn Assessment Test with High Score

LinkedIn jQuery Skills Assessment Test Answers 2022 : A decent method for knowing whether you are ready for evaluation is by tapping on the ability you need to test in the appraisal test segment, and there will be a portrayal of the aptitudes that the test will survey. This way you can know whether there’s a piece of the product you really want to investigate or a piece of the programming language strategies you really want to brush over assuming you feel your insight is running somewhat corroded.

Know your industry

LinkedIn jQuery Skills Assessment Test Answers 2022 : The tests are accessible for checking a wide scope of abilities, from programming abilities to essential realistic planning abilities. You really should show your capability that is connected with the business you are focusing on. Assuming you are searching for a profession in finance, dominating in Adobe Photoshop won’t help you however much an identification announcing your solidarity in Microsoft Excel will. You additionally need to expand your capability as your experience develops, as selection representatives would expect an alumni with 3 years of work insight to show a more extensive scope of abilities than somebody recently out of school.

How to Take LinkedIn Assessment Test with Guaranteed Passing Score

LinkedIn jQuery Skills Assessment Test Answers 2022 : Step by step instructions to Pass LinkedIn Assessment Test: When you at long last focus on getting another line of work, it tends to be overwhelming. The possibility of leaving the past behind and entering the obscure, practically everything associated with the talking system, and on top, all things considered, maybe the pressure of a transition to another city. You stress over having sufficient opportunity to make a quality showing planning for interviews so you can adequately impart your range of abilities. Debilitating.

https://www.videosprofitnetwork.com/watch.xml?key=0552df4fd7e4a0cf0843c17c23524c5b

However, your abilities might have quite recently been given a bull horn. On September 17, LinkedIn sent off an intriguing new instrument on their foundation called “LinkedIn Skill Assessments.” It’s basically another way for you to approve your abilities and better stand apart from the group.

LinkedIn jQuery Skills Assessment Test Answers 2022 : This is The way to Pass LinkedIn Assessment Test. You complete a thoroughly evolved web-based appraisal (planned by LinkedIn Learning and informed authorities) for an ability region you need to show capability in, similar to Adobe Photoshop for instance. Assuming you pass the evaluation, you’re given an identification that will be shown on your profile in LinkedIn Recruiter and LinkedIn Jobs.

This will assist employers with rapidly distinguishing who has the particular abilities they’re searching for and assist you with securing position postings pertinent to your recognized range of abilities. Indeed, LinkedIn says for the people who breeze through an evaluation assessment, they’re then, at that point, sent significant work postings the moment they’re posted. Assuming you don’t pass the evaluation, nobody will know.

LinkedIn says that up-and-comers who finished LinkedIn Skill Assessments are fundamentally almost certain (around 30%) to get recruited.

Why the LinkedIn Skill Assessments Tool May Help You Find a Job

LinkedIn jQuery Skills Assessment Test Answers 2022: Expanding your odds of finding a new line of work by 33% is clearly a considerable lift. Candidates likewise get a method for affirming their capability in an ability. LinkedIn research shared as a feature of the apparatus declaration shows 68% of individuals need to check their ability in an expertise prior to going after a position, and 76 percent wish there was a way an ability could be confirmed so they could tolerate outing according to a likely boss.

The production of identifications gamifies abilities evaluation and gives a strong obvious signal of a task applicant’s capabilities. Think about this — assuming you were going after a position in money and there was an “dominate wizard” identification, how might you feel in the event that your companion, who you knew was applying to, had that identification on their profile, however you didn’t?

Selection representatives win as well. I have been in a recruiting job commonly and at least a few times have employed somebody professing to have specific abilities — which ended up being a leap of faith. Indeed, there are ability check tests you can get expected possibility to take however they’re costly, tedious, and hazard switching off competitors who are sublimely qualified and possess a great deal of the abilities they guarantee.

Obviously, LinkedIn wins incredibly too. The badging framework makes further commitment with their foundation (for example individuals will invest more energy on the stage, which is great for LinkedIn as far as building a propensity) and it could very well expand the worth according to the client for involving the stage for the pursuit of employment by and large.

Assuming you take an abilities evaluation yet don’t pass, LinkedIn then, at that point, offers you designated learning courses to assist you with looking over your abilities so you can pass that appraisal the following time and feel more certain and in charge of future work possibilities.

On the opposite side of the coin, a ton of truly qualified individuals won’t take the abilities evaluation and get an identification. So without the identification, despite the fact that they’re qualified, they’ll be in a difficult spot (versus the people who set aside the effort to pass the appraisal and get an identification). In this manner, it may cause individuals to feel compelled to get the identification, which makes it a more elaborate interaction to involve LinkedIn as a task stage. I can see that switching off some likely clients. Also some portion of me contemplates whether the appraisals will be made somewhat excessively hard — consequently setting off the acquisition of a course to help as a general rule. I additionally keep thinking about whether individuals will feel constrained to “identification gather” presently, eventually watering down the effect of the appraisal checks.

We’ll perceive how much and how quick the expertise appraisal and confirmation apparatus takes off for LinkedIn. In any case, one thing is for sure, it’s an intriguing new choice for breaking out of the messiness.

LinkedIn jQuery Skills Assessment Test Answers 2022

Q1. What’s the difference between these two snippets?

 

$(‘button’).on(‘click’, function(){ alert(‘you clicked the button!’); });

$(‘button’).click(function(){ alert(‘you clicked the button!’); });

 

  •  Only the second one will work; jQuery does not have a function called .on.
  •  The second snippet will not function.
  •  Nothing .click(function) is shorter way to write .on(‘click’, function).
  •  The first snippet will execute for every button on the page, the second will only apply to the first button.

 

Q2. What does the following line of code do?

 

jQuery(‘p’)

 

  •  Loads a paragraph tag from a remote server using AJAX
  •  Aliases jQuery to a variable p
  •  Selects all paragraphs on the page
  •  Creates a new paragraph tag and inserts it into the body tag

 

Q3. Given the following HTML, how could we use one line to hide or show the button?

 

<button class=”btn btn-primary” type=”submit”>Continue to checkout</button>

  •  $(‘.btn-primary’).toggle();
  •  $(‘.btn-primary’).showHide();
  •  $(‘.btn-primary’).not(‘:visible’).show();
  •  $(‘.btn-primary’).css({ display: ‘block’});

Read more : RLinkedIn OOP Assessment Test Answers 2022 – Object Oriented Programming Assessment LinkedIn Test Answers 2022

Q4. Working with AJAX, we may run into situations where a piece of code should not be run until after multiple AJAX calls have completed successfully. Say we need to call two external services for JSON data (a list of students, and a list of classes). And only after retrieving those data will we perform some manipulations on a page. What is the preferred way for dealing with this scenario?

 

https://example.com/json-api/students

https://example.com/json-api/classes

 

  • [ ] $.get([ ‘https://example.com/json-api/students’, ‘https://example.com/json-api/classes’ ], function(studentRequest, classRequest) {

// the rest of the code goes here

});

 

  • [ ]  $.when( $.get(‘https://example.com/json-api/students’), $.get(‘https://example.com/json-api/classes’) ).done(function(studentRequest, classRequest) {

// the rest of the code goes here

});

 

  • [ ] $.bind( $.get(‘https://example.com/json-api/students’), $.get(‘https://example.com/json-                   api/classes’) ).done(function(studentRequest, classRequest) {

// the rest of the code goes here

});

 

  • [x]  $.ajax(‘https://example.com/json-api/students’, { success: function(studentRequest) {                               $.ajax(‘https://example.com/json-api/classes’, { success: function(classRequest) { 

      // the rest of the code goes here 

      } }); } });

 

Q5. Given the snippet of HTML below, what is the difference between the two lines that follow it?

 

<ul>

<li>Item 1</li>

<li>Item 2</li>

<li>Item 3</li>

<li>Item 4</li>

</ul>

$(‘ul’).find(‘li’).get(2);

$(‘ul’).find(‘li’).eq(2);

 

  •  .get() retrieves a DOM element, and can’t be chained, eq() retrieves a jQuery object, and can be chained.
  •  .get() retrieves a jQuery object, and can’t be chained, eq() retrieves a DOM element, and can be chained.
  •  .get() retrieves a jQuery object, and is zero-indexed, eq() retrieves a DOM element, and is 1-indexed.
  •  .get() retrieves a DOM element, and is zero-indexed, eq() retrieves a jQuery object, and is 1-indexed.

 

Q6. Suppose we want to have a ball created from an HTML element (id=ball) move down and to the right from its original location when clicked, and move back into its original place when finished.

Given a starting point of this, which of these snippets would accomplish that goal?

 

$(‘#ball’).click(function() {

// Our code goes here

});

 

  • [x] $(this).animate({ top: ‘+=100’, left: ‘+=100’, }, { duration: 600, complete: function() {                    $(this).animate({ top: ‘-=100’, left: ‘-=100’, }, 600) } });

 

  • [ ] $(this).animate({ top: ‘-=100’, left: ‘-=100’, }, 600, function() { $(this).animate({ top: ‘+=100’,       left: ‘+=100’, }, 600) });

 

  • [ ] $(this).animate({ top: ‘=100’, left: ‘=100’, }, { duration: 600, complete: function() {                         $(this).animate({ top: 0, left: 0, }, 600) } });

 

  • [ ] $(this).animate({ top: ‘100’, left: ‘100’, }, 600, function() { $(this).animate({ top: 0, left: 0, },        600) });

Q7. Given the following CSS and HTML codes below, how could you apply the success class to the feedback div?

 

.success {

color: green;

background: #ddffdd;

}

<div class=”feedback”>

Thank you for answering this survey.

</div>

 

  •  $(‘.feedback’).hasClass(‘.success’);
  •  $.css(‘.feedback’, ‘.success’);
  •  $(‘.feedback’).addClass(‘success’);
  •  $(‘.feedback’).css(‘.success’);

Read More: Linkedin Python Assessment Test Answers 2022 | Linkedin Test Answers 2022 – seotoptoolz

Q8. Below is an example page snippet that includes a couple of messages in a list, and a code snippet that retrieves a few hundred messages from a API endpoints using AJAX. How might we add these items to the page snippet in a way that avoids performance problems with DOM insertions?

 

<div class=”message-area”>

<ul class=”message-area–list”>

<li>Existing message 1</li>

<li>Existing message 2</li>

</ul>

</div>

 

$.get(‘//example.com/api/v1/message’)

.done(function(data) {

var tonsOfItems = data.messages;

// add all these messages to a large page

});

 

  •  tonsOfItems.map(function(item) { $(‘.message-area–list’).append(‘<li>’+item+'</li>’); });
  •  var tonsOfListItems = tonsOfItems.map(function(item)) { return ‘<li>’+item+'</li>’; }); $(‘.message-area–list’).append(tonsOfListItems.join(”));
  •  Removing the event handlers with JavaScript will be slower than removing them $.each(tonsOfItems, function(idx, item) { $(‘<li>’+item+'</li>’).appendTo($messageList); });
  •  $.each(tonsOfItems, function(idx, item) { $(‘.message-area–list’).append(‘<li>’+item+'</li>’); });

 

Q9. What is jQuery?

 

  •  jQuery is a bridge between Java and Javascript that makes native apps easier to write.
  •  jQuery is a plugin for JavaScript that makes database queries easier to write.
  •  jQuery is a collection of JavaScript functions that makes finding and manipulating elements on a page, AJAX, and other things easier.
  •  jQuery is a Chrome extension that allows users to create their own extensions with just a few lines of JavaScript.

 

Q10. We want to create a new jQuery plugin called linkUpdater that can be chained onto other jQuery selector like a normal plugin. It should update all the links in the referenced collection so they open in new windows or tabs. Below is the first cut. What is one problem with this plugin?

 

“user strict”;

($.linkUpdater = function() {

this.find(‘a’).attr(‘target’, ‘_blank’);

})( jQuery );

 

  •  this needs to be wrapped, like $(this), in order to be chained in a plugin.
  •  jQuery plugins can’t be safely authored in strict mode.
  •  In order to be used by other code, plugins need to be added to the global namespace, not wrapped in a function expression.
  •  Our plugin should extend jQuery.fn, not jQuery itself.

 

Q11. Generally speaking, when used on a web page, how should jQuery be installed, and why?

 

  •  Just before the closing body tag, because we want to avoid blocking other resources from loading, and we use the ready method to make sure our code fires after the DOM is ready
  •  Using the highest version number possible because only jQuery 3 and up are compatible with Internet Explorer 7
  •  In the head tag because we want jQuery available as soon as possible
  •  From a CDN because we want to be able to use jQuery online or offline

 

Q12. Given the following HTML, how could we make this button disappear from the page using jQuery?

 

<button class=”btn btn-primary” type=”submit”>Continue to checkout</button>

  •  $(‘.btn-primary’).hide();
  •  $(‘.btn-primary:visible’).not();
  •  $(‘.btn-primary’).visibility(false);
  •  $(‘.btn-primary’).show(false);

 

Q13. What is the difference between $(‘header’).html() and $(‘header’).text()?

 

  •  $(‘header’).html() returns the inner HTML of the header. $(‘header’).text() returns only the text
  •  $(‘header’).html() returns only the HTML tags used, without the text. $(‘header’).text() returns only the text
  •  $(‘header’).html() strips all HTML from the header. $(‘header’).text() always returns an empty string.
  •  $(‘header’).html() returns all headers in an HTML document. $(‘header’).text() the first line of a text file.

 

Q14. When writing jQuery plugins, we often provide default options that may be overridden by the end-user. What jQuery function is most useful for this purpose?

 

  •  $.extend
  •  $.clone
  •  $.fn.extend
  •  $.merge

 

Q15. There are times when you might want to programmatically trigger an event, instead of simply reacting to user input directly. Given this markup, Which choice will NOT cause a click event to the select box when the button is clicked?

 

<article>

<div>

Here’s a button you can click: <button class=”btn”>Click Me</button>

</div>

<form>

<p>

Further down the page, there’s a select box.

</p>

<select>

<option value=”1″>One</option>

<option value=”2″>One</option>

<option value=”3″>One</option>

<option value=”4″>One</option>

</select>

</form>

</article>

 

  •  $(‘button’).on(‘click.myApp’, (function() { $(‘input[type=select]’).trigger(‘click’); });
  •  $(‘button’).on(‘click’, (function() { $(‘input[type=select]’).click()); });
  •  $(‘button’).trigger(function() { $(‘input[type=select]’).click(); });
  •  $(‘button’).click(function() { $(‘input[type=select]’).click(); });

 

Q16. You have an absolutely positioned element inside a relatively positioned parent element, and you want to animate that element within its parent element. What jQuery function is most useful for finding the initial coordinates of the .animate-me?

 

<style>

.parent {

position: relative;

top: 3em;

width: 50%;

min-height: 50vh;

margin: 0 auto;

}

 

.animate-me {

position: absolute;

top: 40px;

right: 30px;

}

</style>

 

<div class=”parent”>

<div class=”animate-me”>

This box will move!

</div>

</div>

 

  •  $(‘.animate-me’).offset();
  •  $(‘.animate-me’).each();
  •  $(‘.animate-me’).position();
  •  $(‘.animate-me’).offsetParent();

 

Q17. You want to work with AJAX using a Promise-like interface instead of nested callback functions. What jQuery API should you use?

 

  •  jQuery.sub
  •  jQuery.ajaxTransport
  •  jQuery.Deferred
  •  jQuery.proxy

 

Q18. What is tricky about jQuery’s nth- filters (:nth-child, :nth-of-type, etc.) relative to other filters?

 

  •  Referring to lists of items, they are 1-indexed (like CSS), not 0-indexed (like JavaScript).
  •  They don’t return the jQuery object, and cannot be chained.
  •  They can return the wrong items if the DOM was recently manipulated.
  •  They are not part of CSS, so they don’t get the performance benefits of passing through the document.querySelectorAll.

 

Q19. jQuery’s AJAX functions return objects that implement the Promise API. As a result, you can chain promises and avoid nested callbacks. What does that look like?

 

  • [x] $.get(‘hhttp://httpbin.org/delay/2’)

          .then(function(response) {

          // Data from first GET is here as ‘response’

         return $.get(‘http://httpbin.org/delay/2’);

        })

       .then(function(response) {

       // Data from second GET is here as ‘response’

      });

 

  • [ ] $.get(‘hhttp://httpbin.org/delay/2’)

.catch(function(response) {

// Data from first GET is here as ‘response’

return $.get(‘http://httpbin.org/delay/2’);

})

.done(function(response) {

// Data from second GET is here as ‘response’

});

 

  • [ ] $.get(‘hhttp://httpbin.org/delay/2’, function(response1) {

// Data from first GET is here as ‘response1’

 

$.get(‘http://httpbin.org/delay/2’, function(response2) {

// Data from second GET is here as ‘response2’

});

});

 

  • [ ] $.get(‘hhttp://httpbin.org/delay/2’)

.then(function(response) {

// Data from first GET is here as ‘response’

return response;

})

.get(‘http://httpbin.org/delay/2’, function(response) {

// Data from second GET is here as ‘response’

});

 

Q20. You want to have a ball that is created from an HTML element (id=ball) move down and to the right of its original location when clicked, and move back to its original place when finished. What snippet, added to the code below, would do this?

 

$(‘#ball’).click(function() {

// Our code goes here

});

 

  • [ ] $(this).animate({

top: ‘-=100’,

left: ‘-=100’,

}, 600, function() {

$(this).animate({

top: ‘+=100’,

left: ‘+=100’,

}, 600)

});

 

  • [x]

$(this).animate({

  top: ‘+=100’,

  left: ‘+=100’,

}, {

  duration: 600,

  complete: function() {

  $(this).animate({

  top: ‘-=100’,

  left: ‘-=100’,

  }, 600)

  }

});

 

  • [ ]

$(this).animate({

top: 100,

left: 100,

}, 600, function() {

$(this).animate({

top: 0,

left: 0,

}, 600)

});

 

  • [ ]

$(this).animate({

top: 100,

left: 100,

}, {

duration: 600,

complete: function() {

$(this).animate({

top: 0,

left: 0,

}, 600)

}

});

Read More: LinkedIn C Objective Assessment Test Answers 2022 – Linkedin C Objective Skill Assessment Quiz Test Answers 2022

Q21. The way .wrap() works is sometimes misunderstood. Given the DOM and jQuery snippets below, what does the modified DOM snippet look like?

 

<div id=”container”>

<div class=”item”>Here’s an item</div>

</div>

$(‘#container’).wrap(‘<div class=”wrapper”></div>’).css(‘border’, ‘2px solid red’);

 

  • [ ] <div class=”wrapper” style=”border: 2px solid red;”>

<div id=”container”>

<div class=”item”>Here’s an item</div>

</div>

</div>

 

  • [x]

<div class=”wrapper”>

  <div id=”container” style=”border: 2px solid red;”>

    <div class=”item”>Here’s an item</div>

  </div>

</div>

 

  • [ ]

<div id=”container” style=”border: 2px solid red;”>

<div class=”wrapper”>

<div class=”item”>Here’s an item</div>

</div>

</div>

 

  • [ ]

<div id=”container”>

<div class=”wrapper” style=”border: 2px solid red;”>

<div class=”item”>Here’s an item</div>

</div>

</div>

 

 

Q22. How can you select the following blockquote AND the list in a single call to jQuery() without chaining?

 

<div class=”quotes”>

<blockquote data-favorite=”false”>A quote</blockquote>

<blockquote data-favorite=”true”>A favorite quote</blockquote>

<blockquote data-favorite=”false”>A quote</blockquote>

<blockquote data-favorite=”false”>A quote</blockquote>

</div>

 

<ul class=”menu-first”>

<li>Item 1</li>

<li>Item 2</li>

<li>Item 3</li>

<li>Item 4</li>

</ul>

 

  •  $(‘.quotes + .menu-first’)
  •  $(‘.quotes .menu-first’)
  •  $(‘.quotes, .menu-first’)
  •  $(‘.quotes’ + ‘.menu-first’)

 

Q23. Effects like show, hide, fadIn, and fadeOut can be called with no arguments, but can also take arguments for how long they should last. Which is NOT a duration argument supported by these functions?

 

  •  “fast”
  •  “extreme”
  •  2000
  •  “slow”

Read More :Fiverr Search Engine Optimization SEO Skills Test Answers 2022

Q24. Though jQuery offers visual effects, it is considered a best practice to use CSS to set up different states triggered by classes, where it makes sense. What’s the easiest way to enable and disable a class bounce on an element with the ID dialog?

 

  •  $(‘#dialog’).classToggle(‘bounce’)
  •  $(‘#dialog.bounce’).removeClass().addClass()
  •  $(‘#dialog’).addOrRemoveClass(‘bounce’)
  •  $(‘#dialog’).toggleClass(‘bounce’)

 

Q25. What is the main difference between selectors and filters?

 

  •  Selectors are used to refine the content that filters have been applied to.
  •  Selectors are used to find and select content in a page. Filters are used to refine the results of selectors.
  •  Filters are used to remove content from the page. Selectors are used to add content to the page
  •  There is no real difference. They are both used to build up lists of page content.

 

Q26. You want to create a custom right-click menu. How might you start the code?

 

  •  $(‘#canvas’).on(‘click.right’, function(){ console.log(‘Handled a right-click’) });
  •  $(‘#canvas’).on(‘contextual’, function(){ console.log(‘Handled a right-click’) });
  •  $(‘#canvas’).on(‘contextmenu’, function(){ console.log(‘Handled a right-click’) });
  •  $(‘#canvas’).on(‘rightclick’, function(){ console.log(‘Handled a right-click’) });

 

Q27. What is the correct way to check how many paragraphs exist on a page using jQuery?

 

  •  $(‘p’).count()
  •  $(‘p’).length
  •  $(‘*’).find(‘p’)
  •  $(‘p’).length()

 

Q28. As with many areas of JavaScript, keeping track of the meaning of this is important and sometimes tricky. What does this mean at each of the two points in this custom plugin snippet?

 

$.fn.customPlugin = function() {

// Point 1

 

return this.each(function() {

// Point 2

})

}

$(document).customPlugin();

 

  •  At Point 1, this means a jQuery object. At Point 2, it means a DOM element.
  •  In this case, they mean the same thing: a jQuery object.
  •  In this case, they mean the same thing: a DOM element.
  •  At Point 1, this means a DOM element. At Point 2, it means a jQuery object.

 

Q29. How can you make the first list item bold and the next item oblique, in a single statement chain?

 

<ul class=”menu-first”>

<li>Item 1</li>

<li>Item 2</li>

<li>Item 3</li>

<li>Item 4</li>

</ul>

 

  • [ ] $(‘.menu-first > li’)

.eq(0)

.css(‘font-weight’, ‘bold’)

.eq(1)

.css(‘font-style’, ‘oblique’);

 

  • [ ] $(‘.menu-first > li’)

.first()

.css(‘font-weight’, ‘bold’)

.after()

.css(‘font-style’, ‘oblique’);

 

  • [ ] $(‘.menu-first > li’)

.first()

.css(‘font-weight’, ‘bold’)

.second()

.css(‘font-style’, ‘oblique’);

 

  • [x] $(‘.menu-first > li’)

  .eq(0)

  .css(‘font-weight’, ‘bold’)

  .next()

  .css(‘font-style’, ‘oblique’);

 

Q30. Which CSS selectors can you NOT use in jQuery?

 

  •  You cannot use multiple class selectors such as .class1.class2.
  •  You cannot use pseudo-classes such as :not or :last-of-type.
  •  You cannot use IDs and classes together, such as #element.class.
  •  None. All CSS selectors are compatible in jQuery.

 

Q31. Starting with some DOM elements in the nested structure below, you assign listeners for the same event to a child element and one of the parents using the JavaScript that follows. You want to ensure that when .leaf is clicked, only its event handler will be fired, instead of the click bubbling up and also firing the parent’s click handler. What do you need to add to its handler function?

 

<ul class=”items” id=”main-menu”>

<li>Item 1<ul>

<li class=”leaf”>Sub Item 1</li>

<li>Sub Item 2</li>

</ul></li>

</ul>

 

$(‘.leaf’).click( function(event) { console.log(‘Sub Item 1 got a click’); } );

$(‘#main-menu’).click( function(event) { console.log(‘Main menu got a click’); } );

 

  •  event.capture();
  •  event.stopPropagation();
  •  event.preventDefault();
  •  event.stop();

 

Q32. Using event delegation, you can listen for events on a lot of different items without having to attach separate listeners to each one. But there are times when you may want to check the type of item receiving the event before doing anything, such as checking if an image was clicked versus a text field. Given the starter code below, which choice shows what jQuery provides to help with that process?

 

<div id=”sidebar”>

<img src=”fancy-button.png” alt=”Pick Me”>

<input type=”text” placeholder=”Fill in something”>

</div>

$(‘#sidebar’).click(function(evt) {

var $target = $(evt.target);

 

// What goes here?

});

 

  •  $($target.get(0) + ‘:image’)
  •  $(‘img’).is($target)
  •  $target.filter(‘img’)
  •  $target.is(‘img’)

 

Q33. There are many ways to create elements that can be added to the page. Which answer is NOT one of those ways, assuming you have the following on the page?

 

<div id=”elements”></div>

 

  • [ ]

$(“#elements”).append($(‘<p class=”appended”>As an HTML string</p>’));

 

  • [ ] var p = document.createElement(‘p’);

var text = document.createTextNode(‘As a DOM element’);

p.appendChild(text);

$(“#elements”).append(p);

 

  • [x] $(“#elements”).append(<p class=”appended”>As a JSX object</p>);

 

  • [ ] $(“#elements”).append($(‘<p>’, {

“class”: ‘appended’,

‘text’: “As an attribute object”

}));

 

Q34. The .addClass() and .removeClass() methods can accept functions as arguments. What does this function do?

 

$(‘#menu’).addClass(function() {

return $(‘body’).attr(‘class’);

});

 

  •  It adds the first class found on the body element to the #menu element.
  •  It adds all classes found on the #menu element to the body tag.
  •  It replaces any classes on the #menu element with all classes from the body tag.
  •  It adds all classes found on the body element to the #menu element.

 

Q35. You’re working on a site that uses an old version of jQuery, and you want to update to a newer version. What’s the most efficient way to do so?

 

  •  Install the newer version of jQuery, go through each script one by one, and fix what looks broken.
  •  Read the change notes for the newer version of jQuery, fix all scripts, install the newer version, and fix anything that remains broken.
  •  Install the newer version of jQuery as well as its Migrate plugin, fix all warnings, and uninstall the Migrate plugin.
  •  Install the newer version of jQuery at the same time, and use jQuery.noConflict() on pages that need the older version.

 

%d bloggers like this: