javascript - Jquery - Selecting a item by ID not working -
i'm doing ionic (angular) app , have following simple code @ head of 1 of templates:
<script> $(document).ready(function(){ alert($('#amountid').attr('id')); }); </script> </head> ... <label class="aquitext item item-input" id="amountid">
i used have tradicional javascript onclick("blablabla") , worked point decided shift jquery , i'm stuck had remove , simplify point. i've tried multiple permutations of this, including using angular's .element keep getting "undefined" on alert. doing wrong?
(no don't errors on console)
edit: seems might related fact have afterwards ionic slide-box, thought have little clue how circumvent it. now, removed slider boxes. seems have "fixed" it.
the full structure is, after script (i trimmed of stuff out):
</script> </head> <body> <ion-view> <ion-content> <ion-slide-box> <ion-slide> </ion-slide> <ion-slide> <div class="subtitle">blabla</div> <form name="newaquisition"> <label class="aquitext item item-input" id="amountid"> <input ng-model='newaquisubmission.amount' type='number' placeholder='aquisition value' required> </label> </form> </ion-slide> </ion-slide-box> </ion-view> </ion-content> </body> </html>
is label in html or part of template , added dom angular?
if run js in console, work? it's timing-problem. $(document).ready
seems to early.
try $scope.init
in angular-controller
Comments
Post a Comment