I am trying to hide the input value of each individual input when clicked
My javascript is working fine but only targets the individual ID listed. I am looking for a more refined method that selects only the clicked input without having to repeat that same block of code 5 times targeting each different ID
$(document).ready(function() { var text = document.getElementById('first_name'); var button = document.getElementById('first_name'); button.onclick = function() { text.value = ''; text.classList.add("lowercase"); } }); input[type=text] { display: block; border: none; border-bottom: 1px solid; width: 100%; padding: 2rem 0 1rem; } input, input[type=submit] { font-family: 'usm', sans-serif; font-size: 0.7rem; letter-spacing: 1pt; text-transform: uppercase; color: #7A7A7A; } input.lowercase { text-transform: none !important; letter-spacing: 0 !important; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <body> <form method="post" action=""> <input type="text" name="first_name" id="first_name" value="First Name*"> <br> <input type="text" name="last_name" id="last_name" value="Last Name*"> <br> <input type="text" name="email" id="email" value="Email Address*"> <br> <input type="text" name="phone" id="phone" value="Phone Number"> <br> <input type="text" name="message" id="message" value="Message*"> <div class="submit" > <input type="submit" name="submit" value="Send" id="submit"> </div><!-- End of Submit --> </form> </body>