Explore 100's Of Free Video Tutorials

Keep Learning, Keep Coding & Keep Sharing

Creating Slider Widget

Notes:

jQuery UI - Creating Slider Widget :

Slider Widget: indicates a slider UI control with handles to get range of numeric values

Creating Slider Widget:

1. Create a new HTML document with basic HTML document structure code

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Slider Demo</title>
</head>
<body>
</body>
</html>

2. Link the necessary jQueryUI libray files to the HTML document

<link href="jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-ui/external/jquery/jquery.js" type="text/javascript"></script>
<script src="jquery-ui/jquery-ui.min.js" type="text/javascript"></script>

3. Code the structure of the widget (i.e. HTML or markup):

To create a slider widget; we need to create an empty div element
<div id="slider"> </div>

4. Select the element using jQuery and call the respective jQuery UI function on it

Select the element using jQuery selector, call slider jQuery UI function on it.
<script type="text/javascript">
$("#slider").slider(); // min=0 and max=100
</script>

Interview Questions: