prop

Warning: Unknown prop on <> tag. Remove this prop from the element

可紊 提交于 2019-12-01 16:54:11
问题 I'm new to react and i was learning subclasses from one of Lynda examples. I'm creating a new subcomponent class called aptList and using this.props.eachItem.ownerName to iterate through each index from the JSON file where ownerName is a property. This is the error i get when i run it in the browser. The data gets fetched but the prop is not getting recognized according to the error however the react console seems to be getting the JSON fine This is the code as taught on Lynda var React =

Should href be set with prop() or attr()? [duplicate]

孤人 提交于 2019-11-30 16:57:24
This question already has an answer here: How to change the href for a hyperlink using jQuery 11 answers .prop() vs .attr() 17 answers If I want to change the href of a link dynamically, should I do so using prop() or attr() ? You would use .attr() , as .prop() is more commonly used for boolean properties such as checked , selected , etc - though it is certainly possible with .prop it's arguably less clear as per your intent Though I do believe that ultimately they are very similar (or used to be) functionality-wise Just a note: the jQuery API site seems to follow the boolean 'sway': .prop() -

changing the img src with jquery

南笙酒味 提交于 2019-11-29 03:38:57
The html structure I have is something like: <ul id="something"> <li> <a href=""> <img src="http://domain.com/directory/file1-128x79.jpg"> </a> </li> <li> <a href=""> <img src="http://domain.com/directory/file2-128x79.jpg"> </a> </li> <li> <a href=""> <img src="http://domain.com/directory/file3-128x79.jpg"> </a> </li> </ul> I'm trying to change the filename from file#-128x79.jpg to file#-896x277.jpg . I don't know how to take the dynamically generated filename and search and replace for the src changes. I found my way to replacing the whole src with 'none' to make sure I got it right so far,

jQuery .prop() returns undefined, while .attr() works as expected for data-*

可紊 提交于 2019-11-29 02:19:50
I am simply trying to get a couple of properties from two elements. Getting the property value from the input element works as expected. The problem is with getting the property data-detail property from the button element. It returns undefined when using .prop() , but works as expected when using .attr() . Can anyone explain this odd behaviour I am witnessing? HTML <div class="formRow"> <label for="firstName">First name</label> <div class="detailsControlBtns"> <button id="editFirstName" class="btn ctaBtn greenBtn editBtn">Edit</button> <button class="btn ctaBtn greenBtn saveBtn" data-detail=

Why jQuery 1.9+ attr() method not deprecated?

早过忘川 提交于 2019-11-27 13:07:56
Can I, a jQuery1.9+ software developer, "deprecate" the use of the attr() method in my day-by-day work? As showed in many questions, .prop() vs .attr() (main) jQuery attr vs. prop, there are a list of props? jQuery attr vs prop? Migrating jQuery 1.8.3 to 1.9.0 - Replacing deprecated .attr() ... etc. ... there are a lot of confusion about "use attr or use prop?" , and, by my (developer's) view point, for all uses of attr() method, we can use prop instead: backward-compatibility : coding new software not need this; performance : John says "Accessing properties through the .attr() method will be

Getting the User Agent with JavaScript

半世苍凉 提交于 2019-11-27 00:45:45
I'd like to get a script that can grab the user's user agent and prop it to an attribute. I'm making a website problems contact form and I usually need to know what browser the user is using. How can I detect the user agent string and prop it as the value of an input element. My html looks something like: <input type="hidden" id="UserAgent" name="User Agent" /> I want the user agent to be added to that as the value attribute so it would look like: <input type="hidden" id="UserAgent" name="User Agent" value="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.53.11 (KHTML, like Gecko

Why jQuery 1.9+ attr() method not deprecated?

自作多情 提交于 2019-11-26 16:13:24
问题 Can I, a jQuery1.9+ software developer, "deprecate" the use of the attr() method in my day-by-day work? As showed in many questions, .prop() vs .attr() (main) jQuery attr vs. prop, there are a list of props? jQuery attr vs prop? Migrating jQuery 1.8.3 to 1.9.0 - Replacing deprecated .attr() ... etc. ... there are a lot of confusion about "use attr or use prop?" , and, by my (developer's) view point, for all uses of attr() method, we can use prop instead: backward-compatibility : coding new

jQuery attr vs prop?

若如初见. 提交于 2019-11-26 13:05:51
Now this isn't just another What's the difference question , I have done some tests(http://jsfiddle.net/ZC3Lf/) modifying the prop and attr of <form action="/test/"></form>​ with the output being: 1) prop Modification test Prop: http://fiddle.jshell.net/test/1 Attr: http://fiddle.jshell.net/test/1 2) Attr Modification test Prop: http://fiddle.jshell.net/test/1 Attr: /test/1 3) Attr then Prop Modification test Prop: http://fiddle.jshell.net/test/11 Attr: http://fiddle.jshell.net/test/11 4) Prop then Attr Modification test Prop: http://fiddle.jshell.net/test/11 Attr: http://fiddle.jshell.net

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

六眼飞鱼酱① 提交于 2019-11-26 11:19:58
This question already has an answer here: .prop() vs .attr() 17 answers I saw in some places .attr() is used in jQuery.In some places .prop() is used.But i searched in SO and google i am very confused .Please tell me the exact difference between these two and when to use them. I have seen the following links jQuery attr vs. prop, there are a list of props? jQuery attr vs prop? But I did not got the answer.Please help me.Thanks in advance. Before giving a downvote please explain the reason, then I will correct in my next post. from docs The difference between attributes and properties can be

Getting the User Agent with JavaScript

徘徊边缘 提交于 2019-11-26 09:28:53
问题 I\'d like to get a script that can grab the user\'s user agent and prop it to an attribute. I\'m making a website problems contact form and I usually need to know what browser the user is using. How can I detect the user agent string and prop it as the value of an input element. My html looks something like: <input type=\"hidden\" id=\"UserAgent\" name=\"User Agent\" /> I want the user agent to be added to that as the value attribute so it would look like: <input type=\"hidden\" id=\