Arc Forumnew | comments | leaders | submitlogin
17 points by nostrademons 2392 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 2391 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 2390 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 2087 days ago | link

vffgf

-----

1 point by murkt 2392 days ago | link

Nice! Compare to Ruby ones :)

-----