Strip word from string
<p>Probably a simple solution, but i don't get it working. I have a table with unique <code>id</code> attributes. Via buttons i can change the order of the table rows. When i click a button i want to receive the current order. This works fine with the code below except for the first value, which is <code>undefined</code>. How can i get rid of that undefined value?</p>

<p><pre><code>
    $("#saveOrder").click(function(e){
        var event = e || window.event;
        event.preventDefault();
        var t = "";
        $("#eventTable tr").each(function(){
            t += $(this).attr("id");
        });
        alert(t);
    });
</pre></code></p>

<p>I tried <code>t += $(this).attr("id").replace("undefined","");</code> but then the script won't <code>alert()</code> anything</p>
