Conditionally make input field readonly in Angular 2 or 4: Advice + Best/which way to do it

You need to use the following (Angular 4): <input [readonly]=”isReadOnly”> If you use att.readonly then the input will always be read-only because the readonly attribute will be present even if its value is false. By using [readonly] Angular will only place the attribute if isReadOnly is true. In HTML, the following is sufficient to cause … Read more

How do I add selectableItemBackground to an ImageButton programmatically?

Here is an example using answer here: How to get the attr reference in code? // Create an array of the attributes we want to resolve // using values from a theme // android.R.attr.selectableItemBackground requires API LEVEL 11 int[] attrs = new int[] { android.R.attr.selectableItemBackground /* index 0 */}; // Obtain the styled attributes. ‘themedContext’ … 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: get value of custom attribute

You need some form of iteration here, as val (except when called with a function) only works on the first element: $(“input[placeholder]”).val($(“input[placeholder]”).attr(“placeholder”)); should be: $(“input[placeholder]”).each( function () { $(this).val( $(this).attr(“placeholder”) ); }); or $(“input[placeholder]”).val(function() { return $(this).attr(“placeholder”); });

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/

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

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)