html - Select the next <td> in a table using jQuery -


i working on asp.net mvc 3 application. building table dynamically data database. have case when third column/cell row dropdown :

<select name="yesnonotapplicable" class="yesnonotapplicable">                             <option value="1">yes</option>                             <option value="2">no</option>                             <option value="3">not applicable</option>                         </select> 

in case fourth column/cell stays empty , if user select 3(not applicable) in fourth cell should shown textbox user can write additional information. have poor knowledge in js , jquery, find out how selected value dropdown :

$(document).ready(function () {         $('.yesnonotapplicable').change(function () {             alert($('.yesnonotapplicable').val());         });     }); 

but instead alert need check if value 3(this far can go myself) , show/hide or append/remove textbox next cell or if talk in dom prespective.

so how can navigate next 1 class=yesnonotapplicable , best way deal text box - put in while i'm creating table , show/hide or deal during run time , append/remove , how that?

if using typed model , html helpers view, better create input element while creating table. reason elements create via jquery won't bound model.

$(document).ready(function () {    $('.yesnonotapplicable').change(function () {        if($(this).val() === "3")          $(this).closest('td').next('td').find('input').show();    }); }); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -