我正在使用MVC5,我在视图中有一个省略号,当我将鼠标悬停在它上面时,我希望显示标题。只有在选项列表中选中任何复选框后,才会显示span的截断值/文本。到目前为止我做了以下事情;但我很难在我看来title="???"
获得头衔。
<div>
<span>PAYMENT TYPE: </span>
<span id="payment-sum" title="???"></span>
</div>
function setPayment() {
var sum = $('input[name=payment-option]:checked').parents('.lbl-option').text().trim();
$('#payment-sum').text(sum);
$('#payment-sum').attr(sum);
}
答案 0 :(得分:1)
我认为你可以做这样的事情来获得标题:
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl } from "@angular/forms";
@Component({
selector: 'app-prova',
templateUrl: './prova.component.html',
styleUrls: ['./prova.component.css']
})
export class ProvaComponent implements OnInit {
myForm:FormGroup = new FormGroup({
nationality: new FormControl('')
});
nationalityList = [
{ description: 'NATIONALITY_ITALIAN', code: 'ITA' },
{ description: 'NATIONALITY_FOREIGN', code: 'EST' }
];
constructor() { }
ngOnInit() {
}
}
如果有帮助,请告诉我!