Started

Selectors

Utilities

Animation

AJAX

CSS

Event

Manipulation

Cookie

String

Attributes

Data

Storage

Miscellaneous

$string.camelCase

Convert a string into camelCase style.
$string.camelCase( string )
  1. string [string]
    The target element.

Notes

This function is usually for CSS property name to convert into correct style.

Example

HTML code
<ul id="css_list">
<li data-name="background">background</li>
<li data-name="background-color">background-color</li>
<li data-name="font-size">font-size</li>
<li data-name="border-left-color">border-left-color</li>
<li data-name="-webkit-border-raidus">-webkit-border-radius</li>
</ul>
<button onclick="start_camelCase()">Convert into camelCase style</button>
JavaScript code
function start_camelCase()
{
	$tag($("css_list"), "li", function (item)
	{
		var name = $data.get(item, "name");
		$html(item, name + " -> " + $string.camelCase(name));
	});
}
Demonstration
  • background
  • background-color
  • font-size
  • border-left-color
  • -webkit-border-radius