jquery - Can't add to DOM content before page load Javascript -


I am currently trying to add a bunch of elements using javascript after querying the parse.

I am able to get the full list if I do not add any click to the list, but if I add click listeners, then only the first 5 items appear in the list.

Here is the code I javascript file, it is said in the first html:

  if (! Parse.User.current ()) {window.location.href = 'Index.html'; } Other {Receiver (); } $ (Document) .ready (function () {$ ('# sign-out'). Click (function () {Parse.User.logOut (); window.location.href = 'index.html';} );   

});

  function getpartners () {var participant = Parse.Object.extend ("participants"); Var query = new pars.q (participants); Query.ascending ("patientID"); Query.find ({Success: Work (Results) {for (var i = 0; i & lt; results.length; i ++) {var object = result [i]; var id = object.get ("patient id" ); $ (".list-group") attachment ("
  • " + id + "& lt; / li & Gt; "(function (id) {$ ('#' + object.get (" Patient ID "). Click (function (e) {e.preventDefault (); if (typef (storage)! ==" Undefined ") {localStorage.setItem (" patient id ", id);} and {// Sorry there is no web storage support ..} window.location = 'profile.html';})}} (id) );}}, Error: function (error) {warning ("error:" + error.code + "" + error. Sh};}}});

    }

    The DOM can not modify the DOM before the page is loaded because DOM is not ready at that point.

    Any dom must be manipulated after the loading event is removed.

  • Comments

    Popular posts from this blog

    java - ImportError: No module named py4j.java_gateway -

    python - Receiving "KeyError" after decoding json result from url -

    .net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -