-1
好的我有下面的代碼,按鈕,當我按下它,我創建divs,我想當dblclick 上的div輸入類型的顏色顯示,並改變div的顏色,但沒有button.The問題是我tryed與變化的選擇,但提交它單曲現在working.Here是代碼htm5輸入類型的顏色和jquery
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<style>
#toolbar{
width:600px;height: 100px;border: 3px solid;
position: absolute;left: 350px;
}
#buttons{
position: relative;top:15px;left:150px;
}
#ButtonElement{
width: 600px;border: 3px solid;position: absolute;top:200px;
height: 600px;
}
#TextElement{
width: 600px;border: 3px solid;position: absolute;top:200px;left:700px;
height: 600px;
}
</style>
</head>
<body>
<div id="toolbar">
<div id="buttons">
<button id="Button">Create Element Button</button>
<button id="Text">Create Element Text</button></div>
</div>
<div id="ButtonElement"><h2>Elements Button</h2></div>
<div id="TextElement"><h2>Elements Text</h2></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
// function Toolbar(){
// this.render=function(){
// $('body').append("<div id='toolbar'></div>");
// };
// this.init=function(){
// $("#toolbar").append("<div id='buttons'></div>");
// };
// this.createButton=function(){
// };
// }
var Colors=[];
var count=0;
function Button(count){
this.background=null;
this.count=count;
this.render=function(){
$("#ButtonElement").append("<div id=div" + this.count +">Nqkakav Tekst</div>");
};
}
Button.prototype.setBackground=function(background){
this.background=background;
};
Button.prototype.getBackground=function(){
return this.background;
};
$("#Button").click(function(){
count++;
var b=new Button(count);
b.render();
$("#div"+ count).dblclick(function(){
var diva=this;
$(this).append("<span id='colorchange'><input type='color' id='color' name='favcolor'></span>");
$("#color").change(function(){
var value=$("#color").val();
cssChange(diva,value);
});enter code here
});
});
</script>
</body>
</html>
so I just want when click on some of the divs colorpicker to show and when i click on some color to change the background of the div.
可以您向我展示代碼 – dganchev
#ButtonElement:active { width:600px; border:3px solid; position:absolute; top:200px; height:600px; } – mortiped