Jump to content

AJAX


benlotan

Recommended Posts

I;m trying to get this to work, i was hoping someone might know how to pull this off...my goal is a text box which you type in someting and click submit, the text form clears and the entered text appears in a div below the text field with a check box next to it. you can enter multiple words... so far i think it works, but when i look at it in the browser it dissapears right away...can anyone help?thankshere is the bit of code<html><head><script type="text/css"></script><script type="text/javascript"> var cb = 1; var stuff = new String; function go() { var e = document.getElementById('email'); var p = document.getElementById('place'); stuff += String(e.value + '<input type="checkbox" id ="'+cb+'"><br>'); p.innerHTML = stuff; e.value = ""; }</script></head><body> <form> <input type="text" id="email"> <input type="submit" value="submit" onclick="go();"> </form> <div id="place"> </div></body></html>

Link to comment
Share on other sites

I've made a few changes

<html><head><script type="text/javascript">var cb=1;var stuff="";function go() {var e = document.getElementById('email').value;var p = document.getElementById('place').value;stuff += '<input type="checkbox" id ="'+cb+'">'+e+'<br />';document.getElementById('place').innerHTML =stuff;}</script></head><body><form ><input type="text" id="email"><input type="button" value="submit" onclick="go();"></form><div id="place"></div></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...