liferay aui - AlloyUI selector for multiple ids -


i want call function on blur of 2 elements, can work single element.

i used a.one() method select elements.

here code:

aui().use('aui-base','aui-io-request', function(a){     a.one('#<portlet:namespace/>hospitalname',         '#<portlet:namespace/>date').on('blur',         function(){      }); }); 

to select multiple elements id in alloyui (and yui), use node.all method , a css selector #id1, #id2, #id3.

for example, solution this:

a.all('#<portlet:namespace/>hospitalname, #<portlet:namespace/>date').on('blur',     function(event){         // event.target blurred element.         /* code here... */     } ); 

see runnable example more details:

yui().use('node', function(a) {      a.all('#hospitalname, #date').on('blur', function(event) {      var input = event.target;      document.getelementbyid('output').innerhtml = input.get('id') + ' blurred';    });    });
<script src="https://cdn.rawgit.com/stiemannkj1/0214fdc4cccaa77d6e504320cf70a571/raw/63d260364730fb067f103c00862c7e65685256df/yui-3.18.1_build_yui_yui-min.js"></script>  hospital name:  <input type="text" id='hospitalname' />  date:  <input type="text" id='date' />  <div id="output"></div>


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -