Text box appear on radio button check

后端 未结 1 840
旧巷少年郎
旧巷少年郎 2021-01-24 04:04

I have the following..

相关标签:
1条回答
  • 2021-01-24 04:37

    If the radio buttons map to the next rows cell you can try this:

    <script type="text/javascript">
        $(function(){
            $("table input:radio").click(function(){
                var $radio = $(this);
                var index = $radio.closest("td").index();
                $radio.closest("tr").next().find("input:text").eq(index)
                    .toggle($radio.is(":checked"));
            });
        });
    </script>
    

    or if there is only 1 textbox in the next row you can try:

    <script type="text/javascript">
        $(function(){
            $("table input:radio").click(function(){
                var $radio = $(this);
                $radio.closest("tr").next().find("input:text")
                    .toggle($radio.is(":checked"));
            });
        });
    </script>
    

    Your markup looks invalid or you just copied/pasted it wrong

    0 讨论(0)
提交回复
热议问题