This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('select').val($('select>option:nth-child(1)').val()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("ul.nav li").click(function () { | |
alert(this.id); // id of clicked li by directly accessing DOMElement property | |
alert($(this).attr('id')); // jQuery's .attr() method, same but more verbose | |
alert($(this).html()); // gets innerHTML of clicked li | |
alert($(this).text()); // gets text contents of clicked li | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('input').bind('keypress', function (event) { | |
var regex = new RegExp("[\d]"); | |
var key = String.fromCharCode(!event.charCode ? event.which : event.charCode); | |
if (!regex.test(key)) { | |
event.preventDefault(); | |
return false; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('input').bind('keypress', function (event) { | |
var regex = new RegExp("^[a-zA-Z0-9]+$"); | |
var key = String.fromCharCode(!event.charCode ? event.which : event.charCode); | |
if (!regex.test(key)) { | |
event.preventDefault(); | |
return false; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var httpContext = new HttpContext(new HttpRequest("", url ?? "http://test", ""), new HttpResponse(new StringWriter())); | |
if (!userName.IsNullOrWhiteSpace()) | |
{ | |
var principal = Substitute.For<IPrincipal>(); | |
principal.Identity.Name.Returns(userName); | |
httpContext.User = principal; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jq = document.createElement('script'); | |
jq.src = "http://code.jquery.com/jquery-latest.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
jQuery.noConflict(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int GetFirstNodeWithDocumentAlias(string docTypeAlias) | |
{ | |
int locationsPageId = -1; | |
DynamicNode searchPage = null; | |
var nodes = new DynamicNode(-1).Descendants(); | |
foreach (DynamicNode node in nodes){ | |
if (node.NodeTypeAlias.ToLower().StartsWith(docTypeAlias.ToLower())) | |
{ | |
searchPage = node; break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (window.console && console.log) { | |
console.log('Hello world!'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Required] | |
[RegularExpression(@"\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b", ErrorMessage = "Invalid email address")] | |
[DisplayName("E-mail addresss")] | |
public string Email { get; set; } |
OlderNewer