Jquery change CSS of child div after clone -


I clone a DIV and change it to CSS properties, but can not figure out how to deliver it Changes the CD In the following example I want to change the yellow-to-blue # description-child's background. CSS:

#wrapper {width: 200px; Background: Gray; } #details {width: 200px; Height: 100px; Background: green; } # Description-Child {Width: 100px; Height: 100px; Background: yellow; }

JS:

  jQuery.noConflict (); JQuery (document) .ready (function () {// clone clone_details = jQuery ("# ​​details"). Clone (); // change css clone_database ({'margin-top': '50px', 'background ':' Red '}); // jQuery ("# ​​description-kid"). CSS (' background ',' blue '); // original disk // render clone jQuery ("# ​​wrapper") Attachments (clone_details);});  

Once you have a jquery object, you select a selector from within the scope Can search with that code of $ Find ()

clone_details.find ('# details-child'). some ();

However, you do not want to end up with duplicated IDs everywhere, so I suggest that you go to classes instead of ID because they are unique is.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -