Questions tagged [prop]

The prop() function was added in jQuery 1.6 library. It returns a property for the first element of the matched set.

The .prop() method gets the property value for only the first element in the matched set. It returns undefined for the value of a property that has not been set, or if the matched set has no elements. To get the value for each element individually, use a looping construct such as jQuery's .each() or .map() method.

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.

347 questions
3
votes
1 answer

Option Prop Changing Default Selected Value - Jquery

So I have a selection list, and if the default value hasn't been changed from --- then return to the form false. Pretty much for validation purposes so we know they picked a title. The problem is that for some reason prop() is changing the default…
Howdy_McGee
  • 10,422
  • 29
  • 111
  • 186
2
votes
2 answers

JQuery disabling button

I build a quick pagination from scratch it kind of works, but for the past half hour I've been trying to get the next and/or previous button to disable at the last page like this: (this one is for the next button) if (currentPage.is(':last-child'))…
user1053263
  • 722
  • 2
  • 16
  • 33
2
votes
1 answer

How to type a component prop in a way that it works with both singular usage and within loops without breaking intellisense?

The Setup I have a heading component whose types look like this. // Heading/index.d.ts import { HTMLAttributes } from 'react'; export const HeadingType: { product: 'product'; marketing: 'marketing'; }; export const HeadingLevel: { h1: 'h1'; …
Praveen Puglia
  • 5,577
  • 5
  • 34
  • 68
2
votes
1 answer

angular child rendering before parent data is received

I have a parent component (app.component) making an http request, assigning the result as this.stats then passing it as a prop to the child (progression.component). my issue seems to be that my child is rendering before it gets any data from the…
luther wardle
  • 439
  • 5
  • 17
2
votes
1 answer

Can't pass value prop to custom input component

I have a custom input component that generally works well. But since yesterday I want to pass to it a value from the parent component in certain cases (namely if a cookie is found for that field, pre-fill the field with the cookie value). Parent…
drake035
  • 3,955
  • 41
  • 119
  • 229
2
votes
1 answer

Vue 3 prop not being passed

I'm trying to pass a simple prop to another component in Vue 3.0.11, but I can't seem to get it to work. Here's my App component: