1 Replies - 3836 Views - Last Post: 22 August 2010 - 01:24 AM

#1 Guest_peter*


Reputation:

jquery color picker

Posted 22 July 2010 - 07:55 AM

I've checked to see that all the files are in the right places, everything I can think of the color picker isn't working.

I have this in the header
<!-- CSS & Javascript -->
<style type="text/css">@import url("style.css");</style>
<style type="text/css">@import url("includes/css/smoothness/jquery-ui-1.8.2.custom.css");</style> 
<link href="blue.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="includes/js/jquery.js"></script>
<script type="text/javascript" src="includes/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="includes/js/jquery-ui-1.8.2.custom.min.js"></script>
<script type="text/javascript" src="includes/js/calendar.js"></script>
<script type="text/javascript" src="includes/js/jsapi.js"></script>


then this is the html for the color picker

<div id="colorchanger">
   <a class="colorbox colorblue" href="?theme=blue" title="Blue Theme"></a>
   <a class="colorbox colorgreen" href="?theme=green" title="Green Theme"></a>
   <a class="colorbox colororange" href="?theme=orange" title="Orange Theme"></a>
   <a class="colorbox colorred" href="?theme=red" title="Red Theme"></a>
</div>


then this is colorpicker.js
google.load("jquery", "1.4.2");
google.setonloadCallback(function()
{
   // Color changer
   $(".colorblue").click(function(){
	  $("link").attr("href", "blue.css");
	  return false;
   });
   
   $(".colorgreen").click(function(){
	  $("link").attr("href", "green.css");
	  return false;
   });
   
   $(".colororange").click(function(){
	  $("link").attr("href", "orange.css");
	  return false;
   });
   
   $(".colorred").click(function(){
	  $("link").attr("href", "red.css");
	  return false;
   });
 
});


Is This A Good Question/Topic? 0

Replies To: jquery color picker

#2 Fratyr   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 139
  • Joined: 10-April 08

Re: jquery color picker

Posted 22 August 2010 - 01:24 AM

<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="includes/css/smoothness/jquery-ui-1.8.2.custom.css" />



You try to set attribute href to unknown element according to your examples:
$(".colorblue").click(function(){
	  $("link").attr("href", "blue.css");
	  return false;
   });


What is "link" after all? It's not a class, not an id, nor the html element you point to.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1