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
Developer
csibbdev
Posts: 67
Registered: ‎09-23-2010
My Device: Curve

Building HTML on the fly at run time - HOW TO?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
	<head>
	    <meta name="viewport" id="viewport" content="initial-scale=1.0,user-scalable=no" />
	    <meta name="x-blackberry-defaultHoverEffect" content="false" /> 
	    <link  rel="stylesheet" type="text/css" href="inbox.css"><link />
		<title>Message List</title>
		<script type="text/javascript" src="Scripts/common.js"></script>
		<script type="text/javascript" src="Scripts/actions.js"></script>
	</head>
	<body>
	    <div class="inboxList">
	        <div class="header" x-blackberry-focusable="true">
	            <p>Today</p>
	        </div>
	        <div class="listItem" x-blackberry-focusable="true" onclick = "openMessage()">
	            <img src="Images/new.png" />
	            <div class="title">SENDER_VARIABLE</div>
	            <div class="time">TIME_VARIABLE</div>
	            <div class="description">MESSAGE_VARIABLE</div>	            
	        </div>

 Can anyone give me a pointer as to how I would build the above using variables dynamically at run time where _VARIABLE would be replaced by values from a series of variables.

 

Thanks in advance

Please use plain text.
Developer
kemasD
Posts: 37
Registered: ‎01-18-2011
My Device: Huron 8800

Re: Building HTML on the fly at run time - HOW TO?

	        <div class="listItem" x-blackberry-focusable="true" onclick = "openMessage()">
	            <img src="Images/new.png" />
	            <div class="title">SENDER_VARIABLE</div>
	            <div class="time">TIME_VARIABLE</div>
	            <div class="description">MESSAGE_VARIABLE</div>	            
	        </div>

If you want to change the _VARIABLE on the fly, you can easily do it using the javascript and I think the easiest way is by leveraging the jQuery. You might want to see jQuery replaceWith.

 

Using that API, you can replace the _VARIABLE inside the div by another value that changed in runtime.

Please use plain text.