FairyBusiness
asked on
What is jquery's equivelant to echo in php??
Hi, I grabbed a value from a form and put it into a var:
$('#submit').click(functio n() {
var name = new String($('form: #name').val());
});
I want to display this value in a div on my page. . . but I cannot figure how to do that. I tried document.write a few times, but either that does not work with jquery or I am doing it wrong. Anyone know how to display variables in jquery??
$('#submit').click(functio
var name = new String($('form: #name').val());
});
I want to display this value in a div on my page. . . but I cannot figure how to do that. I tried document.write a few times, but either that does not work with jquery or I am doing it wrong. Anyone know how to display variables in jquery??
$("#divId").html(varname);
This is append :
you div like this :
<div id="your_div_id"></div>
So :
you div like this :
<div id="your_div_id"></div>
So :
$('#submit').click(function() {
var name = $('#name').val();
//$("#your_div_id").innerHTML(name);
$("#your_div_id").append(name);
});
ASKER
The only two that worked slighty were:
$('#submit').click(functio n() {
var name = $('#name').val();
$("#name1").html(name);
});
and
$('#submit').click(functio n() {
var name = $('#name').val();
$("#name1").append(name);
});
Ok, but its having a strange affect. It shows on the page while its loading but then once its done loading or transmitting data its gone! Its like it flashes on the page for 2 seconds, then nothing!! ?????
$('#submit').click(functio
var name = $('#name').val();
$("#name1").html(name);
});
and
$('#submit').click(functio
var name = $('#name').val();
$("#name1").append(name);
});
Ok, but its having a strange affect. It shows on the page while its loading but then once its done loading or transmitting data its gone! Its like it flashes on the page for 2 seconds, then nothing!! ?????
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
what does the e mean?
and why do you comment out the .innerHTML???
and why do you comment out the .innerHTML???
ASKER
Its not showing at all now:
http://auroriella.com/story.html
I am only testing the first value. When you click Tell Story should show the name Tanya under hello
http://auroriella.com/story.html
I am only testing the first value. When you click Tell Story should show the name Tanya under hello
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and I can't locate the div with the div ID "your_div_id"
ASKER
the lowercase 's' and append worked!!! :) Thanks
You're welcome! Thanks for the points!