jqueryalloy-ui

How create yui_patched id using click jquery


How generate new "id='yui_patched_v3_18_1_1_1493708066807_175'" using click button

thanks


Solution

  • Y.guid() generates unique ids. You can generate a new id on button click like so:

    Y.one('#buttonId').on('click', function(event) {
      var generatedId = Y.guid();
      // Your code here...
    });
    

    Here's a runnable example:

    <script src="https://cdn.rawgit.com/stiemannkj1/0214fdc4cccaa77d6e504320cf70a571/raw/63d260364730fb067f103c00862c7e65685256df/yui-3.18.1_build_yui_yui-min.js"></script>
    <button id="button">Generate Id</button>
    <div id="guid"></div>
    <script>
      YUI().use('node', function(Y) {
        Y.one('#button').on('click', function(event) {
          Y.one('#guid').set('innerHTML', Y.guid());
        });
      });
    </script>