Setting new value for an attribute using jQuery

Works fine for me See example here. http://jsfiddle.net/blowsie/c6VAy/ Make sure your jquery is inside $(document).ready function or similar. Also you can improve your code by using jquery data $(‘#amount’).data(‘min’,’1000′); <div id=”amount” data-min=””></div> Update, A working example of your full code (pretty much) here. http://jsfiddle.net/blowsie/c6VAy/3/

Error:(9, 5) error: resource android:attr/dialogCornerRadius not found

This error occurs because of mismatched compileSdkVersion and library version. for example: compileSdkVersion 27 implementation ‘com.android.support:appcompat-v7:26.1.0’ implementation ‘com.android.support:design:26.1.0’ and also avoid to use + sign with library as in the following: implementation ‘com.android.support:appcompat-v7:26.+’ use exact library version like this implementation ‘com.android.support:appcompat-v7:26.1.0’ Using + sign with the library makes it difficult for the building process to … Read more

jQuery – How to select value by attribute name starts with

If you want all data-* attributes, you can iterate through jq data object: $(‘.slide’).each(function(){ for(data in $(this).data()) console.log(data); // returns confirmID so element as an attribute `data-confirmID` }); But this data object can contains other keys which aren’t attribute, setted for example by some plugins. EDIT To get all kinds of attribute to “starts with”, … Read more

jQuery .attr(“disabled”, “disabled”) not working in Chrome

If you are using jQuery < 1.6 do this: jQuery(“input[type=”text”]”).attr(“disabled”, ‘disabled’); If you are using jQuery 1.6+: jQuery(“input[type=”text”]”).prop(“disabled”, true); See this question: .prop() vs .attr() for references why. Or you can try this: $(‘input:text’).attr(“disabled”, ‘disabled’); see here for info on :text

jQuery attr vs prop?

Unfortunately none of your links work 🙁 Some insight though, attr is for all attributes. prop is for properties. In older jQuery versions (<1.6), we just had attr. To get to DOM properties such as nodeName, selectedIndex, or defaultValue you had to do something like: var elem = $(“#foo”)[0]; if ( elem ) { index … Read more

Toggle input disabled attribute using jQuery

$(‘#el’).prop(‘disabled’, function(i, v) { return !v; }); The .prop() method accepts two arguments: Property name (disabled, checked, selected) anything that is either true or false Property value, can be: (empty) – returns the current value. boolean (true/false) – sets the property value. function – Is executed for each found element, the returned value is used … Read more

Set attribute without value

The attr() function is also a setter function. You can just pass it an empty string. $(‘body’).attr(‘data-body’,”); An empty string will simply create the attribute with no value. <body data-body> Reference – http://api.jquery.com/attr/#attr-attributeName-value attr( attributeName , value )

difference between prop() and attr() in jQuery and when to use attr() and prop() [duplicate]

from docs The difference between attributes and properties can be important in specific situations. Before jQuery 1.6, the .attr() method sometimes took property values into account when retrieving some attributes, which could cause inconsistent behavior. As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() retrieves attributes. example … Read more