Celle di una tabella cliccabili

by Salvatore Rotondo

HTML

<input type="text" id="postazionescelta">
<table>
    <tbody>
        <tr>
            <td id="cell-1"></td>
            <td id="cell-2"></td>
            <td id="cell-3"></td>
        </tr>
    </tbody>
</table>

CSS

td{padding:20px; background-color:#900;}

JavaScript

// On dom ready..
(function($) {
    
    $("td").click(function() {
        var recupero_id = $(this).attr("id");
        $("#postazionescelta").val(recupero_id);
    });
    
})(jQuery);