Is is possible to add a textbox inside a checkbox list?
Here's the problem. I am having a checkbox list in which I need to insert and show a text box if certain checkbox is clicked. Say I have a list Item A Item B Item C Item D
now if user check Item B then a text box should appear between Item B and Item C. Any possibility doing this using C# or Jquery?
Gautam
You can use JQuery to achieve that:
Here's 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 the 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's a demo
Here's the source of information
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With