InterviewSolution
Saved Bookmarks
| 1. |
$.each(myArray, function( i, item ) { let item = "<li>" + item + "</li>"; $("#list").append(item); }); |
|
Answer» jQuery’s hover() function works just like any other event, except that instead of taking one function as an argument, it accepts TWO functions. The first function runs when the MOUSE travels over the element and the second function runs when the mouse moves off the element. The basic structure looks like this: $('#element').hover(function1, function2);For EXAMPLE, when mouses over a LINK with an ID of menu, you want a submenu with an ID of submenu to appear. Moving the mouse off of the link hides the submenu again. The following jQuery code will do the trick. $('#menu').hover(function() { $('#submenu').SHOW(); }, function() { $('#submenu').hide(); }); |
|