jquery UI slider does not show up (css attached) -
having looked @ many similar issues still can not figure out why can not display jquery ui slider. below code.
the js file being loaded , css file in same location. (in same folder html file)
i know jquery ui loaded because not see alert message. still can not see slider. tried
what doing wrong?
<?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script type="text/javascript" src="jquery-1.11.3.min.js"/> <script type="text/javascript" src="jquery-ui.js"/> <link href="jquery-ui.css" type="text/css" rel="stylesheet"/> <script type="text/javascript"> $(document).ready(function () { document.body.innerhtml = "ready..." //ready(); if (jquery.ui) { $("#slider").slider() } else { alert("no jquery ui") } }); </script> <title></title> </head> <body id="mainbody"> <div id="slider"></div> not yet ready... </body> </html>
you replacing of html (including #slider) in body "ready...". makes $("#slider").slider() not work because there's no longer #slider element. better way wrap "not yet ready..." div so:
<body id="mainbody"> <div id="slider"></div> <div id="status">not yet ready...</div> </body> and replace document.body.innerhtml = "ready..." $("#status").html("ready...")
that should trick.
Comments
Post a Comment