I have a jsfiddle here: http://jsfiddle.net/aND4g/2/ I am having a problem with a text input value being displayed.What should happen is that if the Option is \[code\]True or False\[/code\] or \[code\]Yes or No\[/code\], then the Number of Answers text input should always contain the value 1 (ALWAYS, this value can't change); if the user then changes from \[code\]True or False\[/code\] or \[code\]Yes or No\[/code\] option to one of the numbered options, then the text input should go back to 0.The problem though if the user appends the \[code\]True or False\[/code\] or \[code\]Yes or No\[/code\] option into a table row and then changes the option to one of the numbered options, then instead of displaying 0, it is still displaying value 1.My question is how to get this value to change to 0 if the user changes the option from \[code\]True or False\[/code\] or \[code\]Yes or No\[/code\] to one of the numbered options? It is only not changing the value to 0 if the previous option was \[code\]True or False\[/code\] or \[code\]Yes or No\[/code\] before the option change.You can see what the problem is by using the fiddle to see what's wrong. Please follow the simple steps below and you will be able to see the problem:[*]When you open the app, click on the \[code\]Open Grid\[/code\] link and select the button \[code\]True or False\[/code\] or \[code\]Yes or No\[/code\] from the grid. Then click on the \[code\]Add Question\[/code\] button, this will append a row underneath of what you have selected.[*]You can see in the text input in the appended row that the value for Number of answers is 1, this is fine. But in the appended row click on \[code\]Open Grid\[/code\] and select a number option of either 3 or 4. The text input for Number of answers does not change to 0 as it should do, it still displays 1.UPDATE:This is something I found out as well if you use the jsfiddle, follow steps below:[*]Repeat step 1 from the above.[*]Repeat step 2 from the above but before you click on \[code\]Open Grid\[/code\] to change the option, select the \[code\]Answer\[/code\] button at the bottom of the row of either \[code\]True\[/code\] or \[code\]False\[/code\] / \[code\]Yes\[/code\] or \[code\]No\[/code\] (depends which option you chose) then change the option to a number option. You see that the value does change from 1 to 0.So what is causing this to happen in my code?I believe the main problem could be below but not too sure:\[code\]$(this).closest('.option').siblings('.answer').find('.answers').each(function(index) {if (!isNaN(clickedNumber) && index < clickedNumber) { $(this).show(); if (prevButton === 'True or False' || prevButton === 'Yes or No') { // show as blank $(this).closest('.option').siblings('.numberAnswer').find('.answertxt').val(0).show(); } else { // show but don't change the value $(this).closest('.option').siblings('.numberAnswer').find('.answertxt').show(); } } else { $(this).hide(); $(this).removeClass('answerBtnsOn'); $(this).addClass('answerBtnsOff'); } .... function btnclick(btn, iQuestionIndex, bDisableAppend) { //var context = $(btn).parent(); var context = $(btn).parents('tr'); // need to go up one level context.add(context.siblings()); // to collect siblings in other rows since the limit in each row is 7 if (context.length == 0) { context = $(btn).parents('tr'); } var $btn = $(btn); var value = http://stackoverflow.com/questions/14079786/btn.value; var id = $btn.attr('id'); .... updateAnswer(context , iQuestionIndex, bDisableAppend); var container = $btn.closest(".optionAndAnswer"); // here the zero gets assigned var answertxt = $(".answertxt", container); var numberison = $(".answerBtnsOn", container).length; var maxRowValue = http://stackoverflow.com/questions/14079786/$('.gridTxt', container).val(); if (btn.id == "answerTrueRow" || btn.id == "answerFalseRow") return; if (maxRowValue =http://stackoverflow.com/questions/14079786/=='True or False' || maxRowValue =http://stackoverflow.com/questions/14079786/=='Yes or No') { if (answertxt.val() == 1 && numberison == 0) { numberison = 1; } } answertxt.val(numberison); return false; }\[/code\]