Page 1 of 1

Manipulating DOM using JQuery API

Posted: Wed Dec 04, 2013 7:57 pm
by kuvalda

I am trying to manipulate the html DOM on my page using JQuery api when the page is loaded. I've added the following code to the Load event for my Home page (also tried adding it to the Page Show event).

I know the code is executing because I can see the alert box, however, the DOM is not modified. It's working fine outside of Appery. Can you please advise if I am doing something wrong here?

code
$(document).ready(function() {
alert($('#Home_panelMenu').html());
$('#Home_pageHeader').before($('#Home_panelMenu').html());
$('#Home_panelMenu').remove();
});
/code


Manipulating DOM using JQuery API

Posted: Wed Dec 04, 2013 8:27 pm
by Kateryna Grynko

Hi,

It's working. What do you want to do?


Manipulating DOM using JQuery API

Posted: Wed Dec 04, 2013 8:30 pm
by kuvalda

Sorry, not sure what you mean by "working"?

When I test my app in the browser and view the "frame source" in Chrome I can clearly see that the DOM is not modified... am I missing something here?


Manipulating DOM using JQuery API

Posted: Wed Dec 04, 2013 10:12 pm
by Kateryna Grynko

Please post a public link to your app and tell in detail what exactly you want to do.


Manipulating DOM using JQuery API

Posted: Sun Feb 16, 2014 12:08 am
by Jason Cheek

Did you ever find a solution to this? I am having the same problem. I am trying to manipulate the DOM on a page show event with some very simple JQuery. The code is clearly executing but the DOM is clearly not modified in the least.


Manipulating DOM using JQuery API

Posted: Sun Feb 16, 2014 6:46 am
by Alena Prykhodko

Hello Jason,

Please tell us exact steps you have tried, so we can test..


Manipulating DOM using JQuery API

Posted: Sun Feb 16, 2014 8:41 am
by Jason Cheek

I have a List called listShifts, and when the app is loaded I get a JQuery handle like this:
var listShifts = Appery("listShifts");

And I have tried all of these, in and near the 'page show' event:
listShifts.append('...');
listShifts.text('...');
listShifts.html('...');

But the DOM has never changed in the slightest, regardless of the change I'm trying to make.

Though I just made some progress. It seems to work only if I call Appery('...') after the 'page show' event. Is it possible to manipulate the DOM in the background before showing the page to the user? Is this a restriction of the Appery('...') wrapper?


Manipulating DOM using JQuery API

Posted: Sun Feb 16, 2014 8:49 am
by Alena Prykhodko

Sure, see more jQuery events http://docs.appery.io/documentation/w...