Is there a possible way in jQuery to remove a specified value from an input? Like this:
Example:
<input type="text" name="test[]" value="Page1, Page2, Page3, Page4, Page5">
The button:
<button>Click to remove page 4</button>
After:
<input type="text" name="test[]" value="Page1, Page2, Page3, Page5">
You can do:
HTML
<input type="text" id="someput" name="test[]" value="Page1, Page2, Page3, Page4, Page5">
JS
var new_val = $("#someput").val();
new_val = new_val.replace("what to replace", "");
$("#someput").val(new_val);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.