Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, i has an issue related with my previous thread. I want to load the h2 tag "INFORMES" above an ul, so i did my code, but i cannot make it work with drupalgap.
Here's an example:
<script>
function informesAdd() {
var etiqueta = document.createElement("h2");
var texto = document.createTextNode("INFORMES");
etiqueta.appendChild(texto);
var list = document.getElementsByClassName("ui-listview")[0];
list.insertBefore(etiqueta, list.childNodes[0]);
}
</script>
<script>
$( document ).ready(function() {
informesAdd();
});
</script>
This is what i put on the index.html, i tried jquery inline and on a module but i could manage to run it from the debug console. Is there any way to run the code when the page has finished loading? Thanks in advance!!!
Comments
Comment #2
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedYou're probably looking for one of these techniques:
The
pageshow
even is probably what you're looking for.Comment #3
HomerO CreditAttribution: HomerO commentedAppreciate your help. But in this case the page renders when you click it, then it makes an ajax/json call via drupal. So for example if i have this page:
It will works because the page exists, but you cannot see until it's called, but in drupalgap, the page renders (i mean only displays the source html code) after the function has been called. I don't know if it has to be with the time when the page renders or the ajax call.
Thanks in advance
Comment #4
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedInstead of using this:
Try just calling your function in a
pageshow
callback:informesAdd();
Comment #5
HomerO CreditAttribution: HomerO commentedAlready tried but is not working... this is what i have in the console:
and what i want is for example:
Thanks in advance!!!!
Comment #6
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedhttp://api.drupalgap.org/7/global.html#hook_services_postprocess
Comment #7
HomerO CreditAttribution: HomerO commentedSorry for the late response, THAT DID THE TRICK!!!.
postprocess + document.click function did what i want!
Thanks you for your help!!! it was really helpfull.
Comment #8
tyler.frankenstein CreditAttribution: tyler.frankenstein commented