0

I want to remove from the form below.

<form id="product-search" action="" method="get">
   <input type="text" name="min_price" value="" placeholder="Min">
   — 
   <input type="text" name="max_price" value="" placeholder="Max" >
</form>

I tried below jQuery code, but cannot make it work?

$('#product-search').removeByContent('—');​

But this doesn't work. Please any help?

Mohammad
  • 21,175
  • 15
  • 55
  • 84
Sergi Khizanishvili
  • 537
  • 1
  • 7
  • 16

1 Answers1

2

You can use javascript nextSibling property that select sibling text after element.

$("#product-search input:first")[0].nextSibling.nodeValue = "";
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form id="product-search" action="" method="get">
   <input type="text" name="min_price" value="" placeholder="Min">
   — 
   <input type="text" name="max_price" value="" placeholder="Max" >
</form>
Mohammad
  • 21,175
  • 15
  • 55
  • 84