Uncaught TypeError: $ (...) .Attr is not a function [closed]

0

Why does not it work?

$('#chatEnvia').click(function() {
  if ($("#chatEscrita").val() !== "") {
    $.post("inc_chatEnvia.php", {
      acesso: "ok",
      msg: $("#chatEscrita").val(),
      de: $("#de").val(),
      para: $("#para").val()
    });
    $("#chatEscrita").val("");

    $("#chatEnvia").Attr('data-toggle', 'modal');
    $("#chatEnvia").Attr('data-target', '#chatVazio');

  }
});
  

Uncaught TypeError: $ (...) Attr is not a function

$("#chatEnvia").Attr('data-toggle', 'modal');
$("#chatEnvia").Attr('data-target', '#chatVazio');
    
asked by anonymous 26.07.2017 / 15:39

1 answer

2

Function calls are case sensitive, in your example, you are using ".Attr ()", with a capital letter:

 $("#chatEnvia").Attr('data-toggle', 'modal');

Try to use lowercase:

$("#chatEnvia").attr('data-toggle', 'modal');

Documentation: link

NOTE: All jQuery functions follow a lowerCamelCase pattern, that is, the initial letter will always be lower case. More information: link

    
26.07.2017 / 16:47