Issue
Hello I'm workig with jquery in angular app, I want to get all selected option of many select list in my component ts file with jquery, what I did :
$("#selectProp select").each(() => {
var t = $(this);
console.log($(this))
//arr.push($(this).val());
});
console.log(arr)
Here with this
I want to get the select with selected option from user but in this I get :
0 => jQuery.fn.init(1) AppComponent
Here I get the values declared in export class AppComponent
And Here my Html :
<div id="selectProp">
<div *ngFor="let BR of splits; let i = index">
<label for="pet-select">Morceau {{i + 1}}</label>
<div>
<select id="selectAttribut">
<option *ngFor="let prop of lstProp512" [value]="prop.Text">
{{prop.Text}}
</option>
</select>
</div>
</div>
</div>
Solution
Like this it is working :
$('#selectProp select').each((index, element) => {
var conceptName = $(element).find(":selected").text();
console.log(conceptName);
})
Answered By - mecab dev
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.