samedi 25 juin 2016

I want to modify some HTML on my website with Jquery but I cant get the .html to work, what am I doing wrong?

This is an example of what I'm trying to achieve, I just want to add a placeholder="" to the input with Jquery but it's not working. I put both ways that I have tried, with .empty().append() and .html.

<script src="http://ift.tt/1oMJErh"></script>
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>

<body>
  <div class="field address1">
    <label class="caption">
      <input class="field-element field-control" name="address" x-autocompletetype="address-line1" type="text" spellcheck="false" data-title="Line1" />Address 1</label>
  </div>
</body>
<script>
  $(document).ready(function() {

    $(".field address1").empty().append("<h1> who </h1>");
    $('.field address1').html("<h1> what </h1>");

  });
</script>

</html>



Aucun commentaire:

Enregistrer un commentaire