jquery - Displaying random li's display's NULL -
How do I display a random set of list items, I think I have this down. Thanks!
// Calculate the number of li in the list list = $ ("li.contentBlock", obj) .length; Generate a random number from the calculation of
/ / li's random random number = mathematical .floor (mathematics.rendum) * list count 1); // Generate a list of items based on the number of J.Le List = "& lt; li class = 'Content Block' & gt;" + $ ("Li: eq (" + randomListNumber + ")", obj). Html) + '& lt; / Li & gt; "; // target element in which the var place = $ (" ul ", obj) .html (); // Combine the UL compiler and create new newness = first list + location in the list; // current ul and Replace li with newly generated random list $ ("ul", obg) .html (new location);
Is there something like this? Save it as an .html file
gt; Top & gt; & lt; Script src = "http://code.jquery.com/jquery-1.4.2.min.js" & gt; & lt; / script & gt; & lt; script & gt; $ (document) .ready (function () {var len = $ ("ul.contentBlock li"). Length; $ ("ul.contentBlock li"). Each (function () {$ (this) .html (Math .floor (mathematics) .endem () * lane));});}); / lt; / head> gt; body & gt; & lt; ul class = "contentblock" & gt; & Lt; li & gt; & lt; / li & gt;
Comments
Post a Comment