1

I have table with following structure:

<table class="table-info" border='1px' >


    <tr >
        <td class="view" style='background:red; width:100px' ></td>
        <td>6</td>
        <td><span class="title" style="cursor: pointer">Some title</td>
        <td title="url"><a href="#" target="_blank">088835522112</a></td>
        <td>AUDIO</td>
        <td><input class="input-text" type="text" value=""></td>
    </tr>
       <tr >
        <td class="view" style='background:red; width:100px' ></td>
        <td>6</td>
        <td><span class="title" style="cursor: pointer">Some title</td>
        <td title="url"><a href="#" target="_blank">088835522112</a></td>
        <td>AUDIO</td>
        <td><input class="input-text" type="text" value=""></td>
    </tr>
        <tr >
        <td class="view" style='background:red; width:100px' ></td>
        <td>6</td>
        <td><span class="title" style="cursor: pointer">Some title</td>
        <td title="url"><a href="#" target="_blank">088835522112</a></td>
        <td>AUDIO</td>
        <td><input class="input-text" type="text" value=""></td>
    </tr>

</table>​

I want to visualize the value of the input field in "td class='view'". How can I do this with jQuery?

http://jsfiddle.net/dilyan_kn/R4Dqr/

1
  • Nice one! It's a little bit offtopic but can you explain me how to make to validate inputed values that should not be higher than value of the second col (ex. 6)? Commented Aug 26, 2016 at 13:07

3 Answers 3

4

If I got you right, this should work:

​$(".input-text"​).on("keyup", function() {
    $(this).closest("tr").find(".view").html(this.value);
})​​​​​​​​​;​

DEMO: http://jsfiddle.net/R4Dqr/1/

Sign up to request clarification or add additional context in comments.

1 Comment

It's a little bit offtopic but can someone explain me how to make to validate inputed values that should not be higher than value of the second col (ex. 6)?
1

WORKING FIDDLE

$(".input-text").on("keyup", function() {
    $(this).closest("tr").find('td:first').html(this.value);
});​

1 Comment

Nice one! It's a little bit offtopic but can you explain me how to make to validate inputed values that should not be higher than value of the second col (ex. 6)?
0
$('.input-text').bind('keyup', function() 
{ 
  $(this).closest("tr").css('color', 'white').find(".view").html(this.value);
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.