Arc Forumnew | comments | leaders | submitlogin
18 points by nostrademons 5927 days ago | link | parent

Javascript, all done client-side, using JQuery:

  $('body').append('<input id = "myInput" /><input type = "submit" />')
    .find('input[@type=submit]').click(function() {
       val = $('#myInput').val();
       $('body').html('<a href = '#'>click here</a>').find('a').click(function() {
          $('body').html('You said: ' + val);
       });
    });


7 points by tlrobinson 5926 days ago | link

Without JQuery...

<input id="in" type="text" /><input type="submit" onclick="window.result='You said: '+document.getElementById('in').value; document.body.innerHTML='<a href=\'#\' onclick=\'document.body.innerHTML=window.result;\'>click here</a>'" value="Submit"/>

(it's a big hack, I know)

-----

3 points by bdeterling 5924 days ago | link

Using Prototype and even more of a hack: <script src="prototype.js"/><input id="a"/><input type="submit" onclick="h=Element.hide;h('a');h(this);u=Element.update;u('c','Click Here');"/><a id="c" onclick="u('c','You said '+$F('a'))"/>

-----

-3 points by name 5621 days ago | link

vffgf

-----

1 point by murkt 5926 days ago | link

Nice! Compare to Ruby ones :)

-----