I have a webform and we want to only display the controls to the questions we are interested in. Depending on what questions users are answering we may want to display some other controls. We are trying to panel questions up, so if a user clicks inside a textbox say for question 3 (as that is applicable) we want to open up a panel below it with further questions. The bit I am struggling with is how to open said panel when a user clicks inside textbox for q3. I have tried textchanged event, but while that works I want the panel to open up as soon as they have typed, this only opens up once the focus has been lost, I found something online about having JS to trigger the textchange event, however then we loose the focus from the textbox. I have tried just adding OnClick to the textbox and that gives me an event is not define error. Is there a way to force the textbox to fire a click event so we can do a simple panel.visible = true.
2
The simplest and the easiest way to do so is to use JQuery or JavaScript as Muhammad Ryhan Said;
Like:
<script type="text/javascript">
$(document).ready(function() {
$("body").on("change keyup", "[id* = Question1]", function() {
$("div.panel-down-wrapper").show();
// $("div.panel-down-wrapper").hide();
});
});
</script>
Alternatively, if your contents are not hidden in form then you have to definitely use AJAX or POSTBACK.
1