javascript - Appending to dynamic content -
i have set dynamically created divs same class name. want append entirely new div of above mentioned divs.
say class name extra-upper-block
at end of page have code
<script> //function call load dynamic content </script> <script> $('.extra-upper-block').append('<div>new div</div>'); </script>
this throws error in chrome's console
uncaught typeerror: undefined not function
but when code executed in chrome's console after page loaded, works! why doesn't work when load dynamic content before executing append command. help?
use jquery class selector.
$(document).ready(function(){ $('.extra-upper-block').append('<div>new div</div>'); });
wrap code in $(document).ready()
jquery elements available, , include jquery file reference.
note : .append()
method part of jquery.
Comments
Post a Comment