Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
Editable Vinyl/Text Editor using Javascript

Hello as I'm finding ways to create and editable Vinyl or text editor I cant make it work, I want an output similar to this link https://www.stickermule.com/products/vinyl-lettering , I made one but with buttons and it worked but I want to apply it via combo box but it wouldn't work, can someone help me? I'm using HTML CSS and JavaScript.

Here is the code i have tried

    <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    .container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
  }
  p {
      width: 40%;
      border: 1px solid black;
      padding: 10px;
      font-weight: bold;
      font-size: 18px;
  }
  button {
      padding: 10px 20px;
      margin: 5px;
  }
  </style>
</head>
<body>
  
  <div class="container">
    Select Color:
    <select>
      <option>Choose a Color</option>
      <option id="btnRed">Red</option>
      <option id="btnBlue">Blue</option>
      <option id="btnGreen">Green</option>
    </select>
    <textarea style="width: 25%; height: 200px;"></textarea>
  </div>

  <script>
    let btnRed = document.querySelector('#btnRed');
    let btnBlue = document.querySelector('#btnBlue');
    let btnGreen = document.querySelector('#btnGreen');
    let content = document.querySelector('textarea');
    btnRed.addEventListener('click',() => content.style.color = 'red');
    btnBlue.addEventListener('click',() => content.style.color = 'blue');
    btnGreen.addEventListener('click',() => content.style.color = 'green');
  </script>
</body>
</html>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I developed this solution using jQuery for simplicity. When the change event of the <select> element is triggered, the value of the <option> elements is assigned to the <textarea> element whose id attribute is resultTextArea.

enter image description here

$( ".target" ).change(function() {
  $('#resultTextArea').css('color', this.value);
});
.container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="container">
  Select Color:
  <select class="target">
    <option>Choose a Color</option>
    <option id="btnRed" value="red">Red</option>
    <option id="btnBlue" value="blue">Blue</option>
    <option id="btnGreen" value="green">Green</option>
  </select>
  <textarea id="resultTextArea" style="width: 25%; height: 200px;"></textarea>
</div>

about 4 years ago · Juan Pablo Isaza Report

0

I have developed a solution using plain JavaScript in the solution below. The SetColor() method is called when the <select> element's onchange event is triggered; the value of the selected element in the <select> element is assigned to the color style of the <textarea> element.

enter image description here

function SetColor()
{
  var value = document.getElementById("selectElement").value;
  var textareaElement = document.getElementById("resultTextArea");
  textareaElement.style.color = value;  
}
.container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
<div class="container">
  Select Color:
  <select id="selectElement" onchange="SetColor()">
    <option>Choose a Color</option>
    <option id="btnRed" value="red">Red</option>
    <option id="btnBlue" value="blue">Blue</option>
    <option id="btnGreen" value="green">Green</option>
  </select>
  <textarea id="resultTextArea" style="width: 25%; height: 200px;"></textarea>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!