When changing a field value using Javascript, Safari saves the replacement object

Run the following in Safari: https://jsfiddle.net/gkatsanos/2355m5ds/

When I change the .val () of an input field without focusing on it manually in Safari, the placeholder remains. safari bug

$('a').on('click', () => {
  $('#stuff').val('lala');
});
input {
  width: 500px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<form>
  <input id="stuff" type="text" placeholder="This Won't get removed in Safari when we change the value of the input">
  <a href="#">Click this</a>
</form>
Run codeHide result
+4
source share
2 answers

I have the same problem and I posted it under the Apple community a couple of weeks ago. I tried updating jquery to the newest version and without joy. I assume this is an Apple change in webkit that is incompatible with jquery.

enter image description here

+2
source

, Javascript Safari.

, Safari jsfiddle, . " β†’ Javascript Console", , .

Apple (# 33759204).

-1

Source: https://habr.com/ru/post/1660706/


All Articles