Spaces:
Runtime error
Runtime error
| $(document).ready(function() { | |
| $(document).on("chat:creado",function(event){ | |
| $(".tab-switch").off("change") | |
| $(".tab-switch").on("change", radioChanged) | |
| radioChanged() | |
| }); | |
| $("#nuevoChat").on("click", (event) => { | |
| $(document).trigger("chat:crear"); | |
| }) | |
| }) | |
| function radioChanged(){ | |
| let tab = $(".tab"); | |
| let tabActive = $(tab[$(".tab-label input:checked").val()]); | |
| let chat = tabActive.find(".chat") | |
| tab.removeClass("active") | |
| tabActive.addClass("active") | |
| tabActive.find("textarea").focus() | |
| if(chat.length>0){ | |
| chat.scrollTop(chat[0].scrollHeight); | |
| } | |
| } |