I am delegating event handler to elements that are not yet created like this:
$('body').on('change', '#some_elementid', function() {
//actions
});
this is working,
But I want actions
to run right after the element is created without any other events. load
doesnot seem to work..
what is possible here to achieve onload
?
UPDATE:
<div id="some_elementid">
<button id="addmore">+ add more</button>
</div>
by clicking on + add more
, another container will be inserted into #some_elementid
which will have some fields. I want to prepopulate those fields during inserting.
without prepopulation, it will look like:
<div id="some_elementid">
<div>
<input type="text" id="id_0">
<input type="text" id="id_1">
...
</div>
<button id="addmore">+ add more</button>
</div>
I want to manipulate during onload and show like:
<div id="some_elementid">
<div>
<input type="text" id="id_0">
</div>
<button id="addmore">+ add more</button>
</div>
JSfiddle: http://jsfiddle.net/yugaj2x2/
I want to hide "two"
while inserting. because later on clicking some other radio button, "two"
will show up, but not now. this is what I am trying to achieve
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…