function setopacity(opa,id){
//alert(opacity);
document.getElementById("txt"+id).style.opacity = "."+opa;
}
function setBColor(Bclr,id){
document.getElementById("txt"+id).style.background = "#"+Bclr;
}
<div class="col-sm-1">
<input required type="text" value="FF8C66" class="jscolor form-control input-lg" name="Bclr[]" onChange="setBColor(this.value,<?php echo $row; ?>);" >
</div>
<div class="col-sm-1">
<input required="required" placeholder="opacity" value="20" type="number" min="5" class="form-control input-lg" name="opa[]" onChange="setopacity(this.value,<?php echo $row; ?>);" >
</div>
Above is my code (part of code) i'm able to set opacity with above code in my style tag in output but its apply to text and background I mean to both. but I want to apply only to background. how I can done this with my code.
I just try this but not able to get result.
function setBColor(Bclr,id){
document.getElementById("txt"+id).style.background = "#"+Bclr+"."+opa;
}
And willing to get output like this
<li class="drag" thk="1" id="txt1" draggable="true" ondragstart="drag_start(event);" style="top: 231px; left: 64px; font-family: "BalooPaaji-Regular.ttf"; color: rgb(21, 0, 255); background-color: rgb(21, 0, 255,0.2);">Your Text 1 </li>
Update : i just want to add these 2 values +Bclr+"."+opa so i can get output like background-color: rgb(21, 0, 255,0.2); this
Please help me. Sorry for my poor English.
opacityis for the entire element. Use another element to show texts, or omit the opacity, and use a semi-opaque background instead (rgba(r, g, b, a)).