[Solved] Create textbox dynamically in td next to specified td in html table using jquery


Try something like this, it will remove 1st textbox when you click on 2nd option.

Jquery code

<script>
$(document).ready(function(){

    $(".radio_action").click(function(){

        if($(this).val() == "E" ){ 

            $("#other_text").html(""); 
            $("#emp_text").html("<input type="text" >"); 
        }
        else if($(this).val() == "A" ) { 
            $("#emp_text").html("");        
            $("#other_text").html("<input type="text" >"); 
        }
    })      
});
</script>

HTML code

<table>
<tr>
    <td><input type="radio" name="radio_type" value="E" class="radio_action" /> Employee</td>
    <td id="emp_text"></td>
</tr>
<tr>
    <td><input type="radio" name="radio_type" value="A" class="radio_action" /> Another Element</td>
    <td id="other_text"></td>
</tr>
</table>

0

solved Create textbox dynamically in td next to specified td in html table using jquery