如何在javascript中link?
How to link in javascript?
我怎样才能link在javascript,我想linksuggestion.full到#
JS:
var domains = ['hotmail.com', 'gmail.com', 'aol.com'];
var topLevelDomains = ["com", "net", "org"];
$('#email').on('blur', function(event) {
console.log("event ", event);
console.log("this ", $(this));
$(this).mailcheck({
domains: domains, // optional
topLevelDomains: topLevelDomains, // optional
suggested: function(element, suggestion) {
// callback code
console.log("suggestion ", suggestion.full);
$('#suggestion').html("Did you mean? <b><i>" + suggestion.full + "</b></i>?");
},
empty: function(element) {
// callback code
$('#suggestion').html('No Suggestions :(');
}
});
});
HTML:
<label for="email">E-mailadres</label>
<input type="email" name="email" id="email" />
<p id="suggestion"></p>
我试过:
$('#suggestion').html("Did you mean? <b><i>" + <a href="#">'suggestion.full</a>' + "</b></i>?");
提前致谢
您有一些引号位置和类型混淆。试试这个:
$('#suggestion').html('Did you mean? <b><i><a href="#">'+suggestion.full+'</a></b></i>?');
如果 suggestion.full
是 URL,您可以像这样将其添加到 href 中:
$('#suggestion').html('Did you mean? <b><i><a href="'+suggestion.full+'">'+suggestion.full+'</a></b></i>?');
我怎样才能link在javascript,我想linksuggestion.full到#
JS:
var domains = ['hotmail.com', 'gmail.com', 'aol.com'];
var topLevelDomains = ["com", "net", "org"];
$('#email').on('blur', function(event) {
console.log("event ", event);
console.log("this ", $(this));
$(this).mailcheck({
domains: domains, // optional
topLevelDomains: topLevelDomains, // optional
suggested: function(element, suggestion) {
// callback code
console.log("suggestion ", suggestion.full);
$('#suggestion').html("Did you mean? <b><i>" + suggestion.full + "</b></i>?");
},
empty: function(element) {
// callback code
$('#suggestion').html('No Suggestions :(');
}
});
});
HTML:
<label for="email">E-mailadres</label>
<input type="email" name="email" id="email" />
<p id="suggestion"></p>
我试过:
$('#suggestion').html("Did you mean? <b><i>" + <a href="#">'suggestion.full</a>' + "</b></i>?");
提前致谢
您有一些引号位置和类型混淆。试试这个:
$('#suggestion').html('Did you mean? <b><i><a href="#">'+suggestion.full+'</a></b></i>?');
如果 suggestion.full
是 URL,您可以像这样将其添加到 href 中:
$('#suggestion').html('Did you mean? <b><i><a href="'+suggestion.full+'">'+suggestion.full+'</a></b></i>?');