Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="link"><a href="" data-quantity="1" data-product_id="103" data-product_sku="" class="cart-btn button product_type_simple add_to_cart_button ajax_add_to_cart" target="_blank" anycustom-attribute-you-want="smth1">Ссылка</a>
  <a href="" target="_blank" anycustom-attribute-you-want="smth2">Ссылка2</a>
   <a href="" target="_blank" anycustom-attribute-you-want="smth3">Ссылка3</a>

<div class="inline-block">
  <input type="text" class="num-items" value="111" anycustom-attribute-you-want="smth1">

<div class="inline-block">
  <input type="text" class="num-items" value="2" ERRORATTR-anycustom-attribute-you-want="smth2">

<div class="inline-block">
  <input type="text" class="num-items" value="3оостлв" anycustom-attribute-you-want="smth3">



                div {
  margin-bottom: 10px;


                $('.num-items').on('change', function(){
  let myAttr = $(this).attr('anycustom-attribute-you-want'); //берем наш атрибут
  if (!myAttr) { console.log('ошибка 1'); return; } //на всякий проверяем, есть ли он вообще. На случай, если где-то накосячили
  let selector = 'a[anycustom-attribute-you-want="' + myAttr + '"]'; //пишем css-selector, по которому jQuery найдет ссылку с таким же атрибутом
  var myLink = $('a[anycustom-attribute-you-want="' + myAttr + '"]');
  if (!myLink) { console.log('ошибка 2'); return; } //просто проверка, что myLink существует. Лишней не будет и поможет отладить код если где есть косяк
  //Дальше - делаем с нашей ссылкой что угодно. Например, откроем её:$(myLink).attr('href'));
  console.log($(myLink).attr('href')); //и опять же, отчитаемся на всякий случай в консоль