How to remove class after delay in jQuery

To remove class after delay in jQuery you can use one of the snippet below.

Samples

jQuery Sample using setTimeout()

Samples

jQuery Sample using delay() and queue()

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

Please rate this snippet

How to select an element with its name attribute in jQuery

To select an element with its name attribute in jQuery you can use the snippet below.

Samples

Javascript Sample

if you remove the div in div[name=”de.Fesslersoft.Testname”] you will get all elements with the specific name.

You can also have a look at this JSFiddle.

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

Please rate this snippet

How to add or remove a class on hover using jQuery

To add or remove a class on hover using jQuery you can use the snippet below.

Adding a Class

See this JSFiddle for adding a CSS-Class.

$('#test1').hover(function(){  $(this).addClass('hoverClass');});

Removing a Class

See this JSFiddle for removing a CSS-Class.

$('#test1').hover(function(){  $(this).removeClass('hoverClass');});

Please rate this snippet

How to get all types that implement a specific Interface in C# and VB.NET

To retrieve a IEnuemerable of all types in the current or another Assembly that implement a specific Interface / Abstract class and so on, you can use the snippets below.

Methods

C# Version

VB.NET Version

Compatibility: working .NET 2.0 working .NET 3.0 not tested .NET 3.5 not working .NET 4.0 not working .NET 4.5

Do you have an alternate or better method for this task?
If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

Please rate this snippet

How to remove an element using Javascript

To remove an element using javascript, you can use one of the following snippets.

Sample Javascript

//usage document.getElementById("ElementId").remove();
Element.prototype.remove = function() {
	this.parentElement.removeChild(this);
}

Sample Javascript

//usage document.getElementsByClassName("Elements").remove();
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
	for(var index = 0, length = this.length; index < length; index++) {
		if(this[index] && this[index].parentElement) {
			this[index].parentElement.removeChild(this[index]);
		}
	}
}

removeChild() is the only method supported by the DOM to remove a element in Javascript (see -> Mozilla MDN Node.removeChild()).

Please rate this snippet

How to make a List or Collection of class read-only in C# and VB.NET

To make a List or Collection of class read-only in C# and VB.NET you can use the following snippet.

Sample C#

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);
	}
}

Sample VB.NET

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

Please rate this snippet