logo
down
shadow

Get custom attribute value in multiple select


Get custom attribute value in multiple select

By : lizhe
Date : November 22 2020, 10:31 AM
I wish this helpful for you You can use $.data method, like this
code :
$('select[name="caloriecalculator"]').change(function() {
  console.log($(this).data('cal') );
});


Share : facebook icon twitter icon
Magento Product Collection Filter by Custom Multiple Select Attribute

Magento Product Collection Filter by Custom Multiple Select Attribute


By : Wardany
Date : March 29 2020, 07:55 AM
With these it helps Use finset instead of eq (multiple select values are stored in CSV format)
Html 5 custom attribute select using jquery if it has multiple values

Html 5 custom attribute select using jquery if it has multiple values


By : Eson Wang
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I think the Attribute Contains Word Selector will do what you are looking for: jQuery('tr[dataset~="a"]').hide();
Update: Here is a simple example fiddle
Using custom attribute to select multiple HTML elements

Using custom attribute to select multiple HTML elements


By : user2966140
Date : March 29 2020, 07:55 AM
To fix the issue you can do Lets say I want to select the "customAttribute" numbers that are greater than 2 but less than 5 so that I can change a CSS value via jQuery. I can't use the :(ul) :(lt) because the list is out of order so basically I want to do something like...
code :
for (var i = 3; i < 5; i++) {
    $('.hello[customAttribute="' + i + '"]').css();
}
How do I get the custom attribute of a multiple select

How do I get the custom attribute of a multiple select


By : underh1ll
Date : March 29 2020, 07:55 AM
Hope this helps Exactly: Get the array of the selected elements and get their respective custom attributes, like this:
code :
$("select :selected").map((i, el) => $(el).attr("custom")).toArray()
Array [ "Mustolest", "Kellared" ]
Get custom attribute value from multiple select option using Jquery

Get custom attribute value from multiple select option using Jquery


By : Elnar
Date : March 29 2020, 07:55 AM
wish helps you You say that you want to get the attribute value, but you are logging .value instead, which refers to the value attribute. You need to use getAttribute('data-percentage') instead.
code :
function getSelectedOptions() {
  var options = [],
    option;
  var tax = document.getElementById('tax_classes');
  var len = tax.options.length;
  console.clear();
  for (var i = 0; i < len; i++) {
    option = tax.options[i];
    if (option.selected) {
      options.push(option);
      console.log(option.getAttribute('data-percentage'));
    }
  }
}
 
window.addEventListener('DOMContentLoaded', getSelectedOptions);
<select multiple name="tax[]" id="tax_classes" onChange="getSelectedOptions()">
  <option value="2" data-percentage="9.00">CGST(9.00%)</option>
  <option value="1" data-percentage="18.00" selected>GST(18.00%)</option>
  <option value="3" data-percentage="9.00">IGST(9.00%)</option>
  <option value="4" data-percentage="12.00" selected>Tax(12.00%)</option>
</select>
Related Posts Related Posts :
  • How to debug Vue application with google chrome
  • html 5 web app cache download complete javascript alert?
  • Ember.js setupController fired only once
  • How to validate a currency input
  • How to convert my Array of data to key & value pair
  • Statistics circles in CSS
  • So I wanted to make a trig solver in javascript?
  • Showing HighCharts series name on x-axis and in legend
  • In Rails, how can we pass parameters in script?
  • Build Fails: `npm rebuild node-sass --force`
  • Angular Datepicker change dateformat
  • Trying to extract data from between two sets of characters
  • Configuring Jest in WebStorm
  • Uncaught Error: Syntax error, unrecognized expression: tr.ec_portfolio_title,
  • JQuery fading in fading out continuously
  • Unexpected end of input (Line 1) and Undefined Function?
  • How to animate the width of a div slowly with jquery
  • JavaScript + RegEx Complications- Searching Strings Not Containing SubString
  • SignalR - Unable to get property 'client' of undefined or null reference
  • full calendar not displaying when loaded (with backbone)
  • Angular: Update service and share data between controllers
  • ReplaceAll Google script
  • Search for matching LI items in separate UL
  • Access arguments of an... argument
  • Customizing Google custom search jsapi (query strings)
  • React | Can´t load Images > Module not found
  • Dynamically creating buttons in DOJO
  • 404 Not Found in AJAX post call
  • How do I find out, using javascript, what software opened and running my application?
  • Javascript to check the status of wireless connection
  • StarDict support for JavaScript and a Firefox OS App
  • Phonegap event Resume
  • call javascript function on ENTER key press?
  • When is the best time to remove no-js classes from the html tag
  • Recommended email sending languages
  • setInterval not working properly with chrome
  • Does IE create new scope for each script tag?
  • Uncaught SyntaxError: Unexpected token < Underscore and parse issues
  • How to pass captured URL to Email Body in HTML
  • How to structure default nested resources?
  • Store all the keys of a JSON object in a variable
  • Need an efficient way to group the Array of object in javascript
  • a sensible approach to highcharts x-axis labels
  • IDE autocompletion for javascript AMD loading style
  • Bootstrap menu disappears after first click setting the ul style to none
  • split ajax json response errors in each field
  • how to add javascript in head in cmsms
  • REGEX: Finding the correct occurrence order of some given special characters in a string
  • How do you preserve a JavaScript date's time zone from browser to server, and back?
  • Return binary result from phantomjs webserver
  • must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.
  • Replacing a substring of an element's text with another string
  • How do I filter marks greater than or equal to 90 in this array?
  • Modify the text of my radio input button?
  • Clicking on status bar does not scroll to top of app (Trigger.io)
  • Mocha JS: How to highlight specific assertion failure?
  • $.getJSON jquery parsing to HTML
  • Find items of a certain class (a) that are also in other classes (b,c,d)
  • Setting different images for D3 force-directed layout nodes
  • Integrating Dropzone.js with angular
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org