To select a element only if hidden in jQuery you can use the snippet below.
Sample jQuery
$("#myElementId:hidden");
To select a element only if hidden in jQuery you can use the snippet below.
$("#myElementId:hidden");
To select date from datetime in MSSQL you can use the following snippet.
SELECT CONVERT(VARCHAR(10),Testdatecolumn,104) FROM dbo.tblTest
The 104 is for tt.mm.jjjj, a list of formats can be found at the MSDN CAST and CONVERT (Transact-SQL)
To open external links in new window in Javascript you can use the following snippet.
$('a[rel="externalLink"]').click( function() { window.open( $(this).attr('href') ); return false; });
To make a List or Collection of class read-only in C# and VB.NET you can use the following snippet.
public class Test { private readonly List<int> _testList = new List<int>(); public IList<int> TestList { get { return _testList.AsReadOnly(); } } public Test() { _testList.Add(0); _testList.Add(1); _testList.Add(2); _testList.Add(3); _testList.Add(4); _testList.Add(5); } }
Public Class Test Private ReadOnly _testList As New List(Of Integer)() Public ReadOnly Property TestList() As IList(Of Integer) Get Return _testList.AsReadOnly() End Get End Property Public Sub New() _testList.Add(0) _testList.Add(1) _testList.Add(2) _testList.Add(3) _testList.Add(4) _testList.Add(5) End Sub End Class
To make input numeric only in jQuery you can use the following snippet.
$('input.numbersOnlyinput').bind('keypress', function(input) { return (input.which === 0 || input.which === 8 || (input.shiftKey === false && (input.which < 58 && input.which > 47))) ? true : false; }