How to add text box inside checkboxlist in c #?

Can I add a text box inside the checkbox list?

Here is the problem. I have a list of checkboxes in which I need to insert and show a text box if a specific checkbox is selected on it. I have a list Item A Item B Item C Item D

now if the user checks element B, then a text box should appear between point B and point C. Any opportunity to do this using C # or jQuery?

Gautam

+5
source share
1 answer

You can use jQuery to achieve this:

Here is the HTML code:

a<input type="checkbox" name="newsletter" value="Daily" />
b<input type="checkbox" name="newsletter" value="Weekly" />
c<input id="test" type="checkbox" name="newsletter" value="Monthly" />
<input id="txtbox" type="text">
d<input type="checkbox" name="newsletter" value="Yearly" />

Here's jQuery:

$(document).ready(initialize);

    function initialize() {
       $("input#txtbox").hide(); 
       $(":checkbox").click(countChecked);    
    }


    function countChecked() {
        if ($("input#test").is(':checked')) {
            $("input#txtbox").show();                
        }
        else {
            $("input#txtbox").hide(); 
        }
    }

Here is a demo

Here is the source of information

+5
source

All Articles