Interview Questions → JQUERY → jQuery Questionnaire I
jQuery Questionnaire I
if ($("#radio_button_id").is(':checked') == true) {}
if ($('#<%=lst.ClientID %> option').size() < 1) {}
<div id="div1">
<input type="text" />
<input type="text" />
<input type="text" />
<input type="button" />
</div>
<script language="javascript" type="text/javascript">
$(document).ready(
function () {
$('div#div1').children().each(function () {
var nodeName = this.nodeName.toLowerCase();
if (nodeName == "input" && $(this).attr('type') == "text") {
$(this).attr('value','hi');
}
});
});
</script>
$("#<%=list_box_id.ClientID %>").append('<option value="value_of_text">text_you_want_to_show</option>');
<script type="text/javascript">
$(document).ready(function () {
// For design mode
$('#<%=editor.ClientID%>').find('iframe').focus(function () {
alert("focus event fired for Design mode");
});
// For HTML mode
$('#<%=editor.ClientID%>').find('textarea').focus(function () {
alert("focus event fired for HTML mode");
});
});
</script>
<script type="text/javascript">
$(document).ready(function () {
// For design mode
var isctrlKeyPressed = false;
$('#<%=editor.ClientID%>').find('iframe').load(function () {
$('#<%=editor.ClientID%>').find('iframe').contents().bind("keydown keypress", function (e) {
if (isctrlKeyPressed)
return false;
if (e.keyCode == 17)
isctrlKeyPressed = true;
else
isctrlKeyPressed = false;
});
$('#<%=editor.ClientID%>').find('iframe').contents().bind("keyup", function (e) {
if (e.keyCode == 17)
isctrlKeyPressed = false;
});
});
// For HTML mode
$('#<%=editor.ClientID%>').find('textarea').bind("cut copy paste", function (e) {
e.preventDefault();
});
});
</script>