How to use the jquery function in jquery

To help you get started, we’ve selected a few jquery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github epam / miew / demo / scripts / ui / Menu.js View on Github external
Menu.prototype._updateInfo = function (dataSource) {
  if (dataSource && dataSource.id !== 'Complex') {
    return;
  }
  const complex = dataSource;

  const body = $('.panel-menu[data-panel-type=miew-menu-panel-info]').children('.panel-body')[0];

  // remove all existing text
  const parent = body;
  while (parent.firstChild) {
    parent.removeChild(parent.firstChild);
  }

  const frag = document.createDocumentFragment();
  if (!complex) {
    frag.appendChild(createElement('p', null, 'No data loaded yet.'));
    body.appendChild(frag);
    return;
  }

  const { metadata } = complex;
  const h1 = createElement('h1', null, `${metadata.id || complex.name || 'Unknown data'} `);
github Esshahn / spritemate / src / js / List.js View on Github external
<div id="spritelist"></div>
    `;

    $("#window-"+this.window).append(template);

    
    $("#spritelist").sortable({
      cursor:"move",
      tolerance: "pointer",
      revert: '100'
    });

    // this line is ridiculous, but apparently it is needed for the sprite sorting to not screw up
    $("<style type="text/css"> .list-sprite-size{ width:"+this.width+"px; height:"+this.height+"px;} </style>").appendTo("head");

    $("#spritelist").disableSelection();
  }
github TYPO3 / TYPO3.CMS / Build / Sources / TypeScript / backend / Resources / Public / TypeScript / ModuleMenu.ts View on Github external
private initialize(): void {
    const me = this;
    let deferred = $.Deferred();
    deferred.resolve();

    // load the start module
    if (top.startInModule && top.startInModule[0] && $('#' + top.startInModule[0]).length > 0) {
      deferred = this.showModule(
        top.startInModule[0],
        top.startInModule[1],
      );
    } else {
      // fetch first module
      const $firstModule = $('.t3js-modulemenu-action[data-link]:first');
      if ($firstModule.attr('id')) {
        deferred = this.showModule(
          $firstModule.attr('id'),
        );
      }
      // else case: the main module has no entries, this is probably a backend
      // user with very little access rights, maybe only the logout button and
      // a user settings module in topbar.
    }

    deferred.then((): void => {
      me.initializeEvents();
    });
  }
github domino14 / Webolith / djAerolith / wordwalls / static / js / wordwalls / newtable / play_button.jsx View on Github external
const $ul = $(this).children('.dropdown-menu');
      const $button = $(this).children('.dropdown-toggle');
      // Ugh, the position of the , plus the offset of the UL relative
      // to the dropdown toggle button.
      const ulOffsetTop = $ul.parents('.list-table-row').position().top +
        $ul.position().top;
      // how much space would be left on the top if the dropdown opened that
      // direction
      const spaceUp = ulOffsetTop - $button.height() - $ul.height();
      // how much space is left at the bottom
      const spaceDown = $tableScroller.height() - (ulOffsetTop + $ul.height());
      // switch to dropup only if there is no space at the bottom
      // AND there is space at the top, or there isn't either but it
      // would be still better fit
      if (spaceDown &lt; 0 &amp;&amp; (spaceUp &gt;= 0 || spaceUp &gt; spaceDown)) {
        $(this).addClass('dropup');
      }
    }).on('hidden.bs.dropdown', '.dropdown', function hhidden() {
      // always reset after close
github enketo / enketo-core / src / widget / select-autocomplete / jquery.relevant-dropdown.js View on Github external
RelevantDropdown.prototype._init = function() {
    const $input = $( this.element );
    this.listId = $input.attr( 'list' );

    // Insert home for new fake datalist
    this.$fakeDatalist = $( '<ul>', {
        'class': 'datalist widget',
        'id': this.listId
    } ).appendTo( $input.parent() );

    this._updateFakeDatalist();
    this._setEventListeners();
};
</ul>
github j2kun / mwua / js-demo / js / main.js View on Github external
function render(state) {
    $('#rewards').html(renderRewardTable(state.roundRewards));
    $('input').val('');
    $('#cumulativeRewards td').each(function(index) {
        $( this ).text(state.cumulativeRewards[index]);
    });
    let normalizedWeights = normalize(state.weights);
    $('#weights td').each(function(index) {
        $( this ).text(normalizedWeights[index].toFixed(2));
    });
    $('h2 .roundNumber').text(state.roundRewards.length + 1);
    $('#chosenObject').text(state.chosenObject);
    $('#learningRate').val(state.learningRate);
    $('#performance').text(state.performance);

    $('input').bind("enterKey", function() {
        submit();
    });
    $('input').keyup(function(e){
        if(e.keyCode == 13)
        {
            $(this).trigger("enterKey");
        }
    });

    $("input:text").get(1).focus();
}
github jeremyckahn / rekapi / sandbox / basic.js View on Github external
.keyframe(0, {
        'x': 50
        ,'y': 50
      })
      .keyframe(750, {
        'x': 200
        ,'y': 200
      });

    rekapi.play(2);
    console.log(rekapi);
  });



  $('#early-start').click(function () {
    var actor;

    killTest();
    rekapi = setupTestRekapi();
    actor = setupTestActor(rekapi);

    actor
      .keyframe(0, {
        'x': 50
        ,'y': 50
      }, 'easeOutExpo')
      .keyframe(1500, {
        'x': 200
        ,'y': 200
      }, 'easeOutExpo');
github honestbleeps / Reddit-Enhancement-Suite / lib / modules / dashboard.js View on Github external
$dashboardAddComponent.find('#addUserForm').get(0).addEventListener('submit', e => {
		e.preventDefault();
		const thisBasePath = `/user/${$('#addUser').val()}`;
		addWidget({
			basePath: thisBasePath,
		}, true);
		$('#addUser').val('').blur();
		$('#addUserFormContainer').fadeOut(() => $('#addWidgetButtons').fadeIn());
	});
	$dashboardAddComponent.find('#addSearchForm').get(0).addEventListener('submit', e => {
github TYPO3 / TYPO3.CMS / Build / Sources / TypeScript / backend / Resources / Public / TypeScript / GridEditor.ts View on Github external
}

      const $row = $('');

      for (let col = 0; col &lt; this.colCount; col++) {
        const cell = this.data[row][col];
        if (cell.spanned === 1) {
          continue;
        }
        const percentRow = 100 / this.rowCount;
        const percentCol = 100 / this.colCount;
        const $cell = $('').css({
          height: parseInt(percentRow.toString(), 10) * cell.rowspan + '%',
          width: parseInt(percentCol.toString(), 10) * cell.colspan + '%',
        });
        const $container = $('<div class="cell_container">');
        $cell.append($container);
        const $anchor = $('<a data-row="' + row + '" data-col="' + col + '" href="#">');

        $container.append(
          $anchor
            .clone()
            .attr('class', 't3js-grideditor-link-editor link link_editor')
            .attr('title', TYPO3.lang.grid_editCell),
        );
        if (this.cellCanSpanRight(col, row)) {
          $container.append(
            $anchor
              .clone()
              .attr('class', 't3js-grideditor-link-expand-right link link_expand_right')
              .attr('title', TYPO3.lang.grid_mergeCell),
          );</a></div>
github Sylius / Sylius / src / Sylius / Bundle / ShopBundle / Resources / private / js / sylius-province-field.js View on Github external
form.removeClass('loading');
            });
          });
        }
      });
    });

    if (countrySelect.val() !== '') {
      countrySelect.trigger('change');
    }

    if ($.trim($('div.province-container').text()) === '') {
      $('select.country-select').trigger('change');
    }

    const shippingAddressCheckbox = $('input[type="checkbox"][name$="[differentShippingAddress]"]');
    const shippingAddressContainer = $('#sylius-shipping-address-container');
    const toggleShippingAddress = function toggleShippingAddress() {
      shippingAddressContainer.toggle(shippingAddressCheckbox.prop('checked'));
    };
    toggleShippingAddress();
    shippingAddressCheckbox.on('change', toggleShippingAddress);
  },
});