I want to get the span tag which has the particular attribute value.
This is my html
<ul class="dropdown-menu" id="languagelist">
<li ng-repeat="(id, langName) in items" ng-click="switchLanguage(id,langName,$event)">
<span class="glyphicon glyphicon-ok" langAttr={{langName}}> </span>
<a>{{langName}}</a>
</li>
</ul>
In my JS file i have $scope.language
which has the preferred language.
$scope.language
might be "English", "Spanish","Japanese","French"
.
Now in my javascript, I need to get the span tag which has the langAttr
(Atrribute) which equals to my $scope.language
.
How can i use jquery to get the span tag whose attribute value is equal to the $scope.language
I can get all the span tags like this $("#languagelist span")
How can i filter or find the span tag which has the required attribute ?
If anyone knows any simple way, please do help. Thanks in advance.