How to dynamically create span and textbox in javascript?

Posted by Ssjganesh under JavaScript on 12/30/2011 | Points: 10 | Views : 2993 | Status : [Member] | Replies : 4
How to dynamically create a span in javascript and assign values

when i hit a html button....

Note: If i click the button i need assign one to that span,

If i click the button at second time i should assign two to span but the old value should be there finally

i need the result like one,two,three in a single span....




Responses

Posted by: Sksamantaray on: 12/31/2011 [Member] Silver | Points: 25

Up
0
Down
http://www.codeproject.com/Questions/228944/Can-i-get-value-from-javascript-in-Csharp-code-beh
may help you

Thanks,
Sanjay

Ssjganesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarchavada on: 3/26/2019 [Member] Starter | Points: 25

Up
0
Down
I guess this is what you are looking for,

Dynamically Create Span in JS:

<html>
<head></head>
<script type="text/javascript">
var obj=null;
function test()
{
if(obj==null)
{
obj = document.createElement("span");
obj.innerHTML = "0";
document.body.appendChild(obj);
}
var cnt = parseInt(obj.innerHTML);
obj.innerHTML = ++cnt;
}
</script>
<body>
<input type="button" id="button1" value="Button" onclick="test()"/>
</body>
</html>


Dynamically Create Textbox in JS:

function create(param) {
var s= "";
for(var i = 0; i < param; i++) {
s+= '<input type="text" name="Fname">'; //Create one textbox as HTML
}
document.getElementById("screens").innerHTML=s;}

From ASP.NET Software companies in India.

LINK:
http://www.ifourtechnolab.com/asp-dot-net-enterprise-content-management

Ssjganesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Parth123 on: 4/4/2019 [Member] Starter | Points: 25

Up
0
Down
function create(param) {
var s= "";
for(var i = 0; i < param; i++) {
s+= '<input type="text" name="Fname">'; //Create one textbox as HTML
}
document.getElementById("screens").innerHTML=s;
}

Using this you can create textbox dynamically


ASP.NET Software development companies
[url]https://www.ifourtechnolab.com/[/url]

Ssjganesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mskristymurphy on: 4/10/2019 [Member] Starter | Points: 25

Up
0
Down
I am looking for some good blog sites for studying. I was searching for search engines and found your blog site. Well, I like your high-quality blog site design plus your posting abilities. Keep doing it. https://www.goassignmenthelp.com.au/essay-assignment-help/

Ssjganesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response