0

I am working on phonegap.jquery mobile,Angularjs mobile app

I want to triger a click once ihave clicked in some other icon. for that i am calling to a scope function, from their i have tried with $('#id').click(); But it is not working for me.

<div id="clickforsele" ng-click="selectdisplay()"> 

selectbox is <select id="seleid"><options....... </select>

and the scope function is $scope.selectdisplay = function () { $('#seleid').click(); }

it comes to scope function. But from thei i can not trigger the click. some one could help me?

Albert
  • 316
  • 3
  • 15

1 Answers1

-1

What is your goal precisely ? To open the select element ? to select an item ?

If you need to select an item : just use ng-options directive https://docs.angularjs.org/api/ng/directive/ngOptions

In your html

<select ng-options="item as item.label for item in items track by item.id" ng-model="selected"></select>

In your controller :

$scope.selected = null;// initialize this is important you may have trouble if you forget this
$scope.items = []; // same better to init them as empty array 1st if your doing an asynchrnous request to load them after 
$scope.selectdisplay = function () { $scope.selected = $scope.items[1]}// set the second element as selected.

Now if you want to just open the select box i suggest you to check this post How to open select programmatically

Community
  • 1
  • 1
Walfrat
  • 5,363
  • 1
  • 16
  • 35