Friday, 15 March 2013

javascript - jQuery lazy load of element's object or reload it on demand -



javascript - jQuery lazy load of element's object or reload it on demand -

i wondering if it's possible have 1 creation of jquery object element query , when element not available yet, , let's added later other function on page, reload object find element on page?

what trying tests is:

<script> var crab = $('#crab'); </script> <div id="crab">hello crab</div> <script type="text/javascript"> crab.load(); console.log( crab.html() ); </script>

this, of course, still returns undefined. want because phpstorm complains duplicate jquery selectors in functions, because when element exists, have grab it, , delete it, when it's recreated, have 1 time again in same function.

possible? or leave 2 queries on same element when necessary?

thanks

javascript jquery

No comments:

Post a Comment