User Interface Expert Question:
Download Questions PDF

How would we select the 3rd li element and retrieve the value of it's id attribute w/out selecting the li by id? *You can select it by index?

<ul id="list">
<li id="one"></li>
<li id="two"></li>
<li id="three"></li>
<li id="four"></li>
</ul>

UI Developer Interview Question
UI Developer Interview Question

Answer:

$('ul li').eq(2).attr('id');
// or
var item;
$.each($('ul li'), function(i){
if (i == 2){
item = $(this).attr('id');
}
});

Download UI Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Create a new javascript object with the keys of "fname" equal to your first name, "lname" equal to your last name, and "fcolors" equal to and array of 3 of your favorite colors. assign this object to a variable called "me" and log it to the console?With jQuery, construct an array that has the values ["A", "B", "C", "D", "E", "F"] by getting the letters stored in the following html elements and pushing them into the array?

<div class="select-container" data-letter="A">
B
<div class="select-wrapper">
<ul>
<li id="select-first">D</li>
<li></li>
<li>E</li>
<li></li>
C
</ul>
</div>
<div>
<span>F</span>
</div>
</div>