logo
down
shadow

JQuery select elements with custom attributes


JQuery select elements with custom attributes

By : user2952722
Date : November 19 2020, 01:01 AM
Any of those help One way to achieve this is to loop over using .each() and check the custom attribute of each selected element.
Working Code Snippet:
code :
$("[display-order]").each(function(item){
  if($(this).attr('display-order') !== '-1')
    console.log('found');
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="t01">
  <tr>
    <th>HEAD 1</th>
    <th>HEAD 2</th>     
    <th>HEAD 3</th>
  </tr>
  <tr id="Grp1" display-order="0">
    <td>Grp1 data</td>
    <td>Grp1 data</td>      
    <td>Grp1 data</td>
  </tr>
  <tr>
    <td>Grp1 data</td>
    <td>Grp1 data</td>      
    <td>Grp1 data</td>
  </tr>
  <tr>
    <td>Grp1 data</td>
    <td>Grp1 data</td>      
    <td>Grp1 data</td>
  </tr>
  <tr id="Grp2" display-order="-1">
    <td>Grp2 data</td>
    <td>Grp2 data</td>      
    <td>Grp2 data</td>
  </tr>
  <tr>
    <td>Grp2 data</td>
    <td>Grp2 data</td>      
    <td>Grp2 data</td>
  </tr>
  <tr>
    <td>Grp2 data</td>
    <td>Grp2 data</td>      
    <td>Grp2 data</td>
  </tr>
<tr id="Grp3" display-order="0">
    <td>Grp3 data</td>
    <td>Grp3 data</td>      
    <td>Grp3 data</td>
  </tr>
  <tr>
    <td>Grp3 data</td>
    <td>Grp3 data</td>      
    <td>Grp3 data</td>
  </tr>
  <tr>
    <td>Grp3 data</td>
    <td>Grp3 data</td>      
    <td>Grp3 data</td>
  </tr>
</table>


Share : facebook icon twitter icon
jQuery cannot get custom attributes on UL elements

jQuery cannot get custom attributes on UL elements


By : unscsprt
Date : March 29 2020, 07:55 AM
should help you out If you need to use custom attributes for one reason or another, check out HTML5 data- attributes.
code :
<ul id="test" data-required="true"></ul>

console.log($('#test').data('required'));
How to select elements with event attributes using Jquery?

How to select elements with event attributes using Jquery?


By : Baxsie
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I believe that the short answer to your question is no.
Different HTML tags support different events, so they should be hardcoded somewhere in the jQuery code. And reading through the jQuery code, I cannot find any reference to onkeypress event, for example.
code :
$('[onclick], [onkeypress], [etc]');
Using jQuery to select elements with data attributes assigns a null ID to its parent elements

Using jQuery to select elements with data attributes assigns a null ID to its parent elements


By : Robert Nyan
Date : March 29 2020, 07:55 AM
will be helpful for those in need It seems that the creation of those empty identifiers is something that happens on Firefox only. But all browsers I checked with appear to have something similar going on, be it less visible. With Chrome and Opera you can see an active change on the parent div, without any final effect as a result. With IE it's very subtle, nothing is really noticeable in the DOM tree but there is still a light flicker in the style window. Indicating that it is responding to the same thing as well.
When I dug around a bit these quotes from the jQuery documentation about the arguments that can be passed to the .find() method seemed to hold the best clue :
code :
.find("[data-animation]");
.find($("[data-animation]"));
var groups = $('.group');

$(window).on('scroll resize orientationchange', showGroup);

function showGroup() {

  groups.each(function() {

    var group = $(this),
    elements = group.find($('[data-animation]'));
  });
}
How do I select elements with similar attributes using jQuery?

How do I select elements with similar attributes using jQuery?


By : manu dinu
Date : March 29 2020, 07:55 AM
Any of those help You can use jQueries attribute-starts-with-selector:
code :
$(document).ready(function () {
  // all inputs that its name starts with "guest"
  $("input[name^=guest]").click(function () {
    // read the name and apply to id
    $('#'+$(this).attr('name')).toggle();
  });
});
how to use a string of attributes to select elements using Jquery

how to use a string of attributes to select elements using Jquery


By : DcH
Date : March 29 2020, 07:55 AM
hope this fix your issue I'll try to word this in a way that is understandable, but finding it hard to search for answers when it's difficult to put into words what I am trying to achieve(the woes of being new to web dev, but still having fun). , The part you need here is
code :
var Exp = new RegExp('\\b('+selectedTags.join('|')+')\\b');
  $('.reviewTile').hide().filter(function(){
    return $(this).attr('data-tags').search(Exp) > -1;
  }).show();
$(document).ready(function(){
  //Find all tags that are selected
  var selectedTags = ['wyoming' , 'sky'];
  var Exp = new RegExp('\\b('+selectedTags.join('|')+')\\b');
  $('.reviewTile').hide().filter(function(){
    return $(this).attr('data-tags').search(Exp) > -1;
  }).show();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="reviewTile" data-tags="montana sky morning clouds">
  <a href="/review/5c12a0a2e8c8f2111300c903">
    <img class="imgThumb" src="/media/reviews/1.jpg" alt="where are you Image.???">
    <div class="reviewTextSample">
       <p>Here is my first review to see what it will look like and if this will actually work.</p><span class="readMore">...read more</span>
  </div></a>
</div>


<div class="reviewTile" data-tags="wyoming clouds travel park">
  <a href="/review/5c12a0a2e8c8f2111300c904">
    <img class="imgThumb" src="/media/reviews/2.jpg" alt="where are you Image.???">
    <div class="reviewTextSample">
       <p>Here is my Second review to see what it will look like and if this will actually work.</p><span class="readMore">...read more</span>
  </div></a>
</div>
Related Posts Related Posts :
  • TabIndex - hitting tab moves me to Address Bar - unable to work around this using Focus
  • Create JSON from string, to use as object
  • Jquery - How do I make ifModified:true work in .ajax request?
  • Jquery and create html on the fly
  • jQuery Validation not validating on button click
  • Jquery Draggable/Droppable appending multiple divs
  • jQuery selector not working properly. Possible Sizzle bug?
  • enable anchor in twitter bootstrap modal
  • jQuery keydown : Wait for previous event to finish
  • why magnific popup ajax box closes if clicked on content
  • JQPlot pie charts "jqplotDataClick" event fires multiple times
  • Show div as the page scrolls on div height
  • Keypress event for ajax call does not work
  • responsive/fluid jQGrid with Twitter Bootstrap
  • IE10 does not seem to fire load event
  • Remove tipTip tool tip
  • jquery datepicker changing unavailable dates in one instance
  • TableTools plugin export buttons are not working
  • Prepopulate jquery token input textbox
  • Open a fancybox link with ajax
  • Getting jQuery and AngularJS content assist / auto-complete in eclipse for standalone HTML "file"
  • TR alternate background colour with unequal number of TD
  • DATATABLE jQuery TH and TD alignment
  • Jquery UI Convert Select's to Range Slider
  • Change text in text field according to link that has been clicked
  • Animate addClass + removeClass transitions?
  • knockout ajax call data-BIND
  • How do I create a variable with a number based on an element's number position using jquery?
  • Prevent fixed position element from flickering during jQuery animation
  • points are not visible clearly in nvd3 ghaph
  • How to write a regular expression for IP address format
  • Animate 3 DIVs from right to left when page is loading.
  • How to pivot columns in free jqgrid 4.15.4
  • the jquery method works fine but when made as a function not working
  • Show/hide text doesn't work when targeting link within div
  • multiple autocomplete search input fields
  • Display image in cell using Jquery jTable
  • jQuery and Wordpress - Scripts not working
  • flickering when mouse over, .hover() show/hide div(s)
  • Using Django's JSONResponseMixin to respond to AJAX requests
  • Unable to render charts using Wicked PDF
  • Style to dynamically created elements
  • hover not working for items in list
  • Keep server session alive automatically based on activity / input, using JQuery
  • jQuery load() taking a long time
  • Change / Exchange values in textboxes on text change in jquery
  • Unslider arrow code overriding slider options
  • what is the traditional way of sorting search results?
  • Do the action when the DIV comes in the display area of the browser with jQuery
  • jQuery slideshow overlapping CSS ribbon
  • JQuery animate function dont work
  • problems charts jquery highcharts
  • How to reset the select box values in Jquery sumoselect Multi select plugin
  • css absolute position on top of another element
  • How use jQuery String variable in html body
  • Get a row from table in view on modal bootstrap using codeigniter
  • How to make the effect of a div that covers an other div when scrolling?
  • Data binding using a button
  • How do i replace all dot in string to Underscore?
  • grab non-sibling element with jquery
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org