Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Regular Contributor
Posts: 61
Registered: ‎03-28-2010
My Device: Bold 9700
My Carrier: Maxis Malaysia

bbUI - bb.onscreenready : how to manipulate innerHTML?

Hi,

 

Using bbUI toolkit, from my index.htm, I called bb.onscreenready with the following

 

<script type="text/javascript">
bb.onscreenready = function(element, id) {
	if (id == 'manage') {
		initializeDB();
	} 
}
</script>

 

on my 'manage' screen, I have the following 

 

<div data-bb-type="screen">
	<script id="manage" src="manage.js"></script>
	<center><div data-bb-type="title" data-bb-caption="manageScreen" ></div></center>
	<style type="text/css">
		body, html {
			background-color: White;
		}
	</style>
	<div id="results">
		<h1>Result should be here!</h1>
	</div>
</div>

 

and on my manage.js, once fired from onscreenready, supposedly change the content of id="results" to something else via document.getElementById("results").innerHTML = ('Changed!');

 

But this are not the case. Value for the object is null. Am I not doing it correctly?

Highlighted
Developer
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: bbUI - bb.onscreenready : how to manipulate innerHTML?

Is this for Smartphone or Playbook?

 

Either way try putting the inializeDB() into a setTimeout() of a second and see if it works then. Not a solution a great solution, I am just wondering if the bb.onscreenready is firing off too early.

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Developer
Posts: 60
Registered: ‎06-08-2011
My Device: n/a
My Carrier: n/a

Re: bbUI - bb.onscreenready : how to manipulate innerHTML?

Try to access it through the element object:

 

element.getElementById("results").innerHTML = ('Changed!');