Get DIV through a custom attribute [duplicate]

1

I have several DIVs like the one in the code below.

  <div class="col-md-10" ordained-field="0"></div>

How do I get all by the attribute that I created ordained-field

    
asked by anonymous 03.01.2019 / 10:32

1 answer

1

I just needed to define the type of element I want to bring and my custom attribute in brackets:

console.log($('div[ordained-field]'))

I also found a search using a custom attribute with values:

$('div[ordained-field="1"]')
    
03.01.2019 / 10:43