I am sure that the answer has already been given, my problem is that I do not know what to even ask.
I am trying to dynamically add pre-existing HTML separators by cloning them and changing values, and I ran into a problem
HMTL:
<div class="worldRow"> <div class="worldProperties">Name</div> <div class="worldProperties worldName">World name</div> <div class="worldProperties">Population</div> <div class="worldProperties worldPopulation">50</div> <div class="worldProperties">Occupency</div> <div class="worldProperties worldOccupency">45%</div> </div>
Javascript:
function addWorld(data){ var row = $('#fakeWorldList .worldRow').clone(); row = $(row).attr('id',data.worldId); $(row).('.worldName').value('this will never work, halp.'); }
In my javascript, in the last line of my function, I am trying to set a div with class "worldName" to a new value, but I just can't figure out how to do this.
If someone can point me in the right direction, it will be very appreciated.
Greetings
source share