Reputation: 2273
I have a function to select the row and that comes the selected value in the alert box. Now i want that value to store in the page instead of alert box.
Here is the function,
var generic_lookup_Enr_Rds_Section2009_selected = function(id, to_s) { alert(id + to_s)}
It brings the selected value into the alert box. Istead of alert the value i want to display the value into the page like a label or anything. Is it possible?
Upvotes: 0
Views: 89
Reputation: 12998
var add = function(id, to_s) {
$(id).html(to_s);
}
You might also want append
, prepend
or similar.
You basically need to call the function with where you want to text to be. Say you have a span
somewhere on your page with a class="placeholder"
. No you can call add("span.placeholder", "Some text that should be displayed in the span")
.
id
can be any element on your page.
to_s
is any valid string or element that should be placed into id
from above.
Upvotes: 1
Reputation: 25270
just use jQuery text function:
function putStringInDiv(id, to_s){ $("'#"+id+"'").text(to_s); }
the id should be your div's id. like
<div id="myDiv"></div>
then calling the function will assign the text into the div:
putStringInDiv('myDiv','some text here');
Upvotes: 1