<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(function(){
$("#btn").on("click",function(){
$("#p"+$("#line_num").val()).css("background-color",$("#line_color").val());
})
})
</script>
</head>
<body>
<div class="wrapper">
<div id="p1">P1</div><br>
<div id="p2">P2</div><br>
<div id="p3">P3</div><br>
<div id="p4">P4</div><br>
<div>
<input type="text" placeholder="줄 번호를 입력하세요." id="line_num">
<input type="text" placeholder="색을 입력하세요" id="line_color">
<input type="button" value="적용" id="btn">
</div>
</div>
</body>
</html>