5

hmm ok heres the shortened code

 <div id="SideCategoryList">
        <div class="BlockContent">
           <ul>
              <li><a href="#">Link A</a></li>
              <li><a href="#">Link B</a></li>
          </ul>
       </div>
     </div>
    <div id="navcont">
    <ul class="menu" id="menu">
      <li id="hov"><a href="#">Top Link</a></li>
      <li><a href="#">Bottom Link</a></li>
    </ul>
   </div>

i want to use jquery to duplicate whats in the first ul into the first li in the #menu so it looks like this

<div id="SideCategoryList">
        <div class="BlockContent">
           <ul>
              <li><a href="#">Link A</a></li>
              <li><a href="#">Link B</a></li>
          </ul>
       </div>
     </div>
    <div id="navcont">
      <ul class="menu" id="menu">
         <li id="hov"><a href="#">Top Link</a>
            <ul>
               <li><a href="#">Link A</a></li>
               <li><a href="#">Link B</a></li>
            </ul>
        </li>
        <li><a href="#">Bottom Link</a></li>
      </ul>
   </div>

so the finished product will be a 2 level list... let me know if this is makin sense lol

1
  • i know there is .clone().appendTo() but i've been messing with it for like 2 hours Commented Dec 14, 2010 at 22:30

3 Answers 3

3
$("#hov").append($(".BlockContent ul").clone());
Sign up to request clarification or add additional context in comments.

1 Comment

nice one :) I was looking at it trying to figure out what the difference was in terms of browser interpretation/rendering.
1
var content = $('#BlockContent').html();

$('#hov').append(content);

will append the content at the end of all the innerhtml of $('#hov').

ie after the <a href="#">Top Link</a>.

hope that helps :)

Comments

0

maybe something like this...

var copied_html = $('#BlockContent').html();
copied_html.insertAfter($('#menu li#hov a'));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.