attr

How can I replace a window's URL hash with another response?

佐手、 提交于 2019-12-03 10:24:49
问题 I am trying to change a hashed URL (document.location.hash) with the replace method, but it doesn't work. $(function(){ var anchor = document.location.hash; //this returns me a string value like '#categories' $('span').click(function(){ $(window).attr('url').replace(anchor,'#food'); //try to change current url.hash '#categories' //with another string, I stucked here. }); }); I dont want to change/refresh page, I just want to replace URL without any responses. Note: I don't want to solve this

How to get an enum which is created in attrs.xml in code

余生长醉 提交于 2019-12-03 02:53:25
问题 I created a custom View (find it here) with an declare-styleable attribute of type enum. In xml I can now choose one of the enum entries for my custom attribute. Now I want to create an method to set this value programmatically, but I can not access the enum. attr.xml <declare-styleable name="IconView"> <attr name="icon" format="enum"> <enum name="enum_name_one" value="0"/> .... <enum name="enum_name_n" value="666"/> </attr> </declare-styleable> layout.xml <com.xyz.views.IconView android:id="

Using attribute to modify a drawable element color

[亡魂溺海] 提交于 2019-12-03 01:29:10
I try to make a custom Drawable by using attribute but I have an inflating error 01-21 11:01:06.171: E/AndroidRuntime(13695): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/action_bar_background.xml from drawable resource ID #0x7f020000 My action_bar_background.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:angle="90" android:endColor="?attr/ActionBarEndColor" android:startColor="?attr/ActionBarStartColor" /> </shape> My attr.xml <?xml version="1.0"

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

走远了吗. 提交于 2019-12-03 01:15:07
I was attempting to answer someone elses question . And in doing so realised there was quite a bit of uncertainty in my mind about a few things. I'm hoping someone can provide feedback on the numbered points 1..4: Task: Conditionally make input field readonly Relevant section of HTML: <input type="text" placeholder="Club Name" #clubName> Add this to Typescript component. // class properties @ViewChild('clubName') inp:HTMLInputElement; // Could also use interface Element // conditionally set in some other methods of class inp.setAttribute('readonly', 'readonly'); inp.removeAttribute('readonly')

How to get an enum which is created in attrs.xml in code

∥☆過路亽.° 提交于 2019-12-02 18:18:08
I created a custom View (find it here ) with an declare-styleable attribute of type enum. In xml I can now choose one of the enum entries for my custom attribute. Now I want to create an method to set this value programmatically, but I can not access the enum. attr.xml <declare-styleable name="IconView"> <attr name="icon" format="enum"> <enum name="enum_name_one" value="0"/> .... <enum name="enum_name_n" value="666"/> </attr> </declare-styleable> layout.xml <com.xyz.views.IconView android:id="@+id/heart_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" app:icon=

How to add text from span tag to data-attr by jQuery?

放肆的年华 提交于 2019-12-02 18:13:47
问题 How to add text from span tag to data-attr? Example: I have this code <div class="clearfix colelem" id="u92-5"><!-- content --> <p>Icon<span id="u92-2">iconsymbol</span></p> </div> And I want to add iconsymbol to data-attr="iconsymbol" of the same element like a: <div class="clearfix colelem" id="u92-5" data-attr="iconsymbol"><!-- content --> <p>Icon<span id="u92-2">iconsymbol</span></p> </div> Yes and it will be with all elements which has a title="icon" <script> $( document ).ready

attr as property in css selector [duplicate]

ε祈祈猫儿з 提交于 2019-12-02 09:20:43
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: CSS selector by style attribute html: <div data-family='arial'></div> in css i want to use this family value. Example: div{font-family: attr(data-family)} Family can be any string. How make it work? 回答1: Try this code: div[data-weight="bold"]{ font-weight: bold; } http://www.w3.org/TR/selectors/#attribute-selectors JSFIDDLE 回答2: You can use the following: div[data-weight="bold"] { font-weight: bold; } But I don

attr as property in css selector [duplicate]

[亡魂溺海] 提交于 2019-12-02 04:26:22
Possible Duplicate: CSS selector by style attribute html: <div data-family='arial'></div> in css i want to use this family value. Example: div{font-family: attr(data-family)} Family can be any string. How make it work? Try this code: div[data-weight="bold"]{ font-weight: bold; } http://www.w3.org/TR/selectors/#attribute-selectors JSFIDDLE You can use the following: div[data-weight="bold"] { font-weight: bold; } But I don't believe there's any way to use an attribute as a property without some JavaScript You cannot achieve what you ask about in pure CSS. Using jQuery it could be done this way:

jquery string to function convert

妖精的绣舞 提交于 2019-12-02 02:17:23
问题 is this possible? <div id="anything">I will change</div> <div id="id" jq="$('#anything').css({background: 'red'})"></div> var x = '$('#id').attr('jq')'; jQuery.call(x); Basically i would like use an attribute jq on any tag to act like a onclick would on html that calls the javascript statements. btw jQuery.call() is for demonstration purposes it doesn't work... 回答1: You would use eval() but what you are doing seems like a really bad idea: var x = $('#id').attr('jq'); eval(x); The reason this

Why ?attr/colorAccent dose not work below lollipop version?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 21:37:28
问题 I have added themes to my application. For this I have used multiple accent colors to add on image button. I have a xml file named fab selector xml , which gives shape and color to image button. But its giving exceptions on this file. 1st exception is inflateException for class image button. 2nd is resource not found Exception for fab selector. Fab selector resides in drawable folder. Its also showing ,, Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x2 if i