Non capisco come aggiungere un textarea
tipo nell'avviso sweet
. Simile a type: "input"
Come aggiungere tag textarea come elemento di input in allerta utilizzando jQuery
$('#saveBtn).click(function(){
swal({
title: "Enter your Name!",
text: "your name:",
type: "input",
showCancelButton: true,
closeOnConfirm: false,
showLoaderOnConfirm: true,
animation: "slide-from-top",
inputPlaceholder: "Write something" },
function(inputValue){
if (inputValue === false)
return false;
if (inputValue === "") {
swal.showInputError("You need to write something!");
return false
}
swal("Nice!", "You wrote: " + inputValue, "success");
});
});
Questo funziona bene. Ma se io uso type: "textarea"
invece di type: "input"
Questo dà errore come questo:
sweetalert.min.js:1 Uncaught ReferenceError: logStr is not defined
Grazie per l'aiuto.
mostrare ciò che avete codificato ... –
$ ('# saveBtn, # createNewBtn') clicca (function() { \t \t swal ({ \t \t \t titolo: ". Inserisci il tuo nome!", \t \t \t testo: "il tuo nome:", \t \t \t tipo: "input", \t \t \t showCancelButton: vero, \t \t \t closeOnConfirm: false, \t \t \t showLoaderOnConfirm: vero, \t \t animazione \t: "slide-from-top", \t \t \t inputPlaceholder: "Write something"},Funzione\t \t \t (InputValue) { \t \t \t \t se (InputValue === falsa) \t \t \t \t \t return false; \t \t \t \t se (InputValue === "") { \t \t \t \t \t swal.showInputError ("devi scrivere qualcosa"!); \t \t \t \t \t return false \t \t \t \t \t} \t \t \t \t swal ("Nice", "Hai scritto:" + InputValue, "successo"); \t \t \t}); \t}); –
@Guruprasad. Potresti dirmi dove sto sbagliando? –