greetings,
I'm new with java script so bear with me! I want to achieve something using JQuery selectors.
I have a list menu. It looks like this...
<ul style="width:auto">
<li>item one</li>
<li>item two</li>
<li>item three</li>
<li>item four</li>
<li>item five</li>
</ul>
Okay, so currently I'm using the parseInt function to retrieve the integer value of the current width of the ul.
var ul = $("ul");
var currentWidth = parseInt(ul.width);
var maxWidth = 400;
With that giving me the current width I'd like to now create an if statement. This is where it gets really tricky for me.
if(currentWidth <= maxWidth){
alert('great job, do nothing');
}
else {
// WHAT DO I DO?!
// I need to take all the elements that makes the ul exceed that maxWidth variable and assign them to a new array called extraItems
}
So how do I get those items. I fear this is so far beyond the basic!
Any help would be so greatly appreciated!