Note that there are some explanatory texts on larger screens.

plurals
  1. POstrange behavior with asp.net text box when made read only
    text
    copied!<p>I have a asp.net page - it renders a number of custom controls, within the main page - I have a asp.net Textbox - in certain cases it has to be editable in others it has to be read only. For the most part it is all working as expected. There is a small bug I am having difficulty with.</p> <p><img src="https://i.stack.imgur.com/A8zhr.jpg" alt="enter image description here"></p> <p>So in my Previous Year column the values rendering should only be 1, 2, 3, 0 - etc - as you can see for some reason when rendering the markup it creates this markup:</p> <pre><code>&lt;td id="ctl00_ctl00_PartContentPlaceHolderMain_ContentPlaceHolderMain_ctl00_ctrlComparison_ctrlComparisonCars1_ctl06"&gt; &lt;input name="ctl00$ctl00$PartContentPlaceHolderMain$ContentPlaceHolderMain$ctl00$ctrlComparison$ctrlComparisonCars1$tbPreviousNoManualCars" type="text" value="1" disabled="disabled" id="ctl00_ctl00_PartContentPlaceHolderMain_ContentPlaceHolderMain_ctl00_ctrlComparison_ctrlComparisonCars1_tbPreviousNoManualCars" class="tbPreviousNumber ui-widget-content ui-corner-all" style="width:50px;display:none;"&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;1&lt;/span&gt; &lt;/td&gt; </code></pre> <p>So the problem being the double span that is generated. In my main page that renders this control I want to do something like:</p> <pre><code> var test = $("#ctl00_ctl00_PartContentPlaceHolderMain_ContentPlaceHolderMain_ctl00_ctrlComparison_ctrlComparisonCars1_PreviousNoManualCars").children().find('span').val(); alert(test); </code></pre> <p>However my alert says undefined. Is it possible to remove one of these spans using something similar to the above?</p> <p>Also is there a better way to get the id that will be rendered - I have just pulled the exact one on screen from Developer Tools just for testing to try and get this working.</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload