how to get text which is in input td using jquery

JavaScript
$(function(){
    $("#onpressofabutton").click(function(){
        var data1 = $(this).find("td:eq(0) input[type='text']").val();
        var data2 = $(this).find("td:eq(1) input[type='text']").val();
    });
});
Source

Also in JavaScript: