I have a problem with getting value from a radio from a sweet alert. I want to give value from a radio to my HTML page.
addTags is a button,
radioV is from <p id="radioV"></p>
in html.
Any ideas?
$scope.addToTags = function() {
var inputOptions = new Promise(function(resolve) {
setTimeout(function() {
resolve({
'n': 'nouns',
'a': 'adjectives',
'v': 'verbs',
'o': 'others',
'i': 'idioms',
'a': 'all'
})
}, 1000)
})
swal({
title: 'Select only one:',
input: 'radio',
inputOptions: inputOptions,
inputValidator: function(result) {
return new Promise(function(resolve, reject) {
if (result) {
resolve()
} else {
reject('You need to select something!')
}
})
}
})
.then(function(result) {
swal({
type: 'success',
html: 'You selected: ' + result
})
})
.then(function(result) {
$('#radioV').attr(result).val();
})
};