Skip to main content

CODING

jQuery - Detect Mouse Button Click

At the first place we need to assume that our HTML code contains the code:

<div id="buttondiv">Button</div>
<br/>
<p>Press Mouse Button over the "Button" text above</p>

Next step is to add jQuery code to check which mouse button is clicked:

C# - Replace BR Tag / New Line

Here is a code snippet for replacing br tag with new line in C# 

jQuery - Bind/Unbind Event to Element

With jQuery it is easy to add events to our HTML elements.

<div id="buttondiv">Button</div>

In this example method bind() will be used. It attaches the specific event to the given element.

C# - First Letter to Upper Case

Here is a code snippet for transforming first letter to upper case in C# 

jQuery - Creating DOM Node

jQuery is a JavaScript library that is not only capable for changing element's content but it can create DOM nodes, too.

In this article, as a part of our jQuery tips ans tricks, jQuery will be used for creating DOM node in runtime.

We're going to use the next HTML code as a sample for adding new element to:

<div id="testdiv">
    jQuery creating DOM node article
</div>

Some of jQuery methods that could be used for creating DOM nodes are: