attr

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

╄→尐↘猪︶ㄣ 提交于 2019-12-01 20:04:57
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 use <solid android:color="?attr/colorAccent" /> ?attr/colorAccent and it works fine if I use <solid

jquery attr prop checkbox已有checked=checked但不显示勾选问题

青春壹個敷衍的年華 提交于 2019-12-01 18:05:15
最近在做项目的过程中碰到了这样的一个问题:在使用bootstrap模态框的过程中,在模态框中有一个checkbox标签,一开始是为选中的,当点击触发模态框按钮,选中chcekbox时,会显示勾选,这个时候将选中的状态缓存起来,然后点击模态框中的关闭按钮,再次点击触发模态框按钮弹出模态框,这个时候问题出现了: checkbox标签已有checked=checked但是不显示勾选,查看图片: 网上也查过有解决方案,就是将 $("...").attr("checked", true)改为$("...").prop("checked", true),问题解决,但是,问题是解决了,那么原因是出现在哪里呢? 首先来了解下 jquey中的 attr()函数和prop()函数,attr()是处理 attribute的值的,而prop()是处理 property 的值的 ,jQuery 1.6之前 ,.attr()方法在取某些 attribute 的值时,会返回 property 的值,这就导致了结果的不一致。从 jQuery 1.6 开始, .prop()方法 方法返回 property 的值,而 .attr() 方法返回 attributes 的值,那么归根结底,就是在处理 attribute 和 property。 很多attribute节点有一个相应的property属性

jQuery .attr retrieving custom attribute returns undefined

谁都会走 提交于 2019-12-01 16:25:45
i have the following problem using jquery. I have sth like this <div id="yxz" value="1"> <span class="delete"></span> </div> now I have this fn but it only returns "undefined", it does however return the id, or class if I ask for this. $(".delete").click(function(){ alert($(this).parent("div").attr("value")); }); I used to get this value with the same attr stuff. Does this have sth to do with me using the jquery 1.6.1 now instead of 1.5.2. Thanks for your help. To retrieve the value of elements, use val() . Since divs don't have values, you should use data() to set and get data. I can confirm

jQuery .attr retrieving custom attribute returns undefined

别来无恙 提交于 2019-12-01 15:10:16
问题 i have the following problem using jquery. I have sth like this <div id="yxz" value="1"> <span class="delete"></span> </div> now I have this fn but it only returns "undefined", it does however return the id, or class if I ask for this. $(".delete").click(function(){ alert($(this).parent("div").attr("value")); }); I used to get this value with the same attr stuff. Does this have sth to do with me using the jquery 1.6.1 now instead of 1.5.2. Thanks for your help. 回答1: To retrieve the value of

jQuery .attr('value') returns undefined for text area

痴心易碎 提交于 2019-12-01 11:10:56
I have a page which dynamically brings in a form via ajax and displays it in a modal div (one that sits above an overlay div that covers the entire page). This is to let them save certain data before a window closes. Everything works great except one thing. $('#save_close_form').find('*[name]').each(function(index, form_element) { var cfe = (form_element.jquery == undefined ? $(form_element) : form_element); console.log(cfe.attr('name') + " => " + cfe.attr('value')); if (cfe.attr('name').match(/data\[/)) { if (cfe.attr('type') == 'checkbox') { if (cfe.attr('checked')) { map[cfe.attr('name')] =

Toggle images on click using jQuery

那年仲夏 提交于 2019-12-01 08:41:53
问题 I have two images which I need to toggle on clicking on the image. <img id='arrowRotate' src='images/prof_arrow1.png' data-swap='images/prof_arrow.png' data-src='images/prof_arrow1.png' /> When the user click the image the src should get the value of data-swap and when you click again the src should change to data-src . This should keep happening just like a toggle. Any help appreciated. $("#arrowRotate").click(function() { var swapImage = $("#arrowGrey").attr("data-swap"); $("#arrowGrey")

jQuery .attr('value') returns undefined for text area

醉酒当歌 提交于 2019-12-01 08:06:01
问题 I have a page which dynamically brings in a form via ajax and displays it in a modal div (one that sits above an overlay div that covers the entire page). This is to let them save certain data before a window closes. Everything works great except one thing. $('#save_close_form').find('*[name]').each(function(index, form_element) { var cfe = (form_element.jquery == undefined ? $(form_element) : form_element); console.log(cfe.attr('name') + " => " + cfe.attr('value')); if (cfe.attr('name')

CSS attr() concatenation with url path [duplicate]

那年仲夏 提交于 2019-12-01 06:36:09
This question already has an answer here: string concatenation in css 5 answers How can I concatenate the CSS attr() selector with static text in a url() field? The HTML I use: <div image='/Require/static.png'></div> //Example 2 <div image='static.png'></div> //Example 3, 4, 5 For example: //image attribute contains the image name (and prefix location when needed, see example 2) div[image]:before { background-image: url('/Image/static.png'); //Works background-image: url(attr(image)); // Works background-image: url('/Image/' attr(image)); //Fails background-image: url('/Image/' #attr(image));

How can I get id,class or name attr an element with jquery

∥☆過路亽.° 提交于 2019-12-01 06:30:40
I'm new in jquery. How can I get name,ID or class name an element with jquery.I'm trying as; <div class="className" onclick="getname();"></div> <div id="idName" onclick="getName();"></div> <div name="attrName" onclick="getName()"></div> function getName(){ attrName = $(this).attr("name"); alert(attrName); } but doesn't work Firstly using jQuery you should attach click() handlers rather than use antiquated onclick attributes. Then you can use the this keyword in the manner you have in your function. Try this: <div class="className"></div> <div id="idName"></div> <div name="attrName"></div> $

How can I get id,class or name attr an element with jquery

◇◆丶佛笑我妖孽 提交于 2019-12-01 05:53:24
问题 I'm new in jquery. How can I get name,ID or class name an element with jquery.I'm trying as; <div class="className" onclick="getname();"></div> <div id="idName" onclick="getName();"></div> <div name="attrName" onclick="getName()"></div> function getName(){ attrName = $(this).attr("name"); alert(attrName); } but doesn't work 回答1: Firstly using jQuery you should attach click() handlers rather than use antiquated onclick attributes. Then you can use the this keyword in the manner you have in