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
0
votes
1 answer

Dynamically added property not visible in html element

I added the 'disabled' property to a textbox input field dynamically with jQuery. But looking to the generated HTML, it's not visible on the textbox input field to which I have added the 'disabled' property to. And because it's not added to it, my…
Quoter
  • 4,236
  • 13
  • 47
  • 69
0
votes
0 answers

Jquery Checkbox control not working as expected

If the selected option is not nil, the checkbox is checked. When the option is nil, it is not unchecked. $('#gradable_items_wrapper select').change -> selected_option = $("option:selected", @) gi_id = selected_option.data('gradable_item_id') …
hellion
  • 4,602
  • 6
  • 38
  • 77
0
votes
1 answer

.prop if statement with JQuery

I'm trying to understand why when I use a .prop() on a radio button for an if statement it will always return false. My goal is to have JS run only if the "#manualOverrideNo"radio button is selected. If anyone could enlighten me I would be very…
mario
  • 1,503
  • 4
  • 22
  • 42
0
votes
1 answer

jQuery and Local Storage: Selector with Multiple States

I am currently working on a drop-down for changing the fonts on a site. Presently, there are a few different fonts available from the drop-down. The code that is called when one of the drop-down sections is clicked is as…
Zyniker
  • 283
  • 3
  • 14
0
votes
1 answer

Confusion about checkbox-checking

I have somewhat around 100 courses with checkboxes that has class course-chkbox and I'm using the following code: //Make sure user has checked at least one course if ($('.course-chkbox:checked').length === 0) { alert('You have to have at…
bestprogrammerintheworld
  • 5,417
  • 7
  • 43
  • 72
0
votes
2 answers

jquery: How to select the checkbox that has an array value in its attribute name?

How can I use jquery to select the checkbox that has an array value in its attribute name? html, My attempt that does not…
Run
  • 54,938
  • 169
  • 450
  • 748
0
votes
3 answers

Disable opposite input if I type into another of a pair

How do I disable one input field if I type into another out of a pair and then if I removed the input by hitting backspace for example so there is nothing in the input field reenable the second input field and vice versa. Code I have so far is below…
Ben Paton
  • 1,432
  • 9
  • 35
  • 59
0
votes
2 answers

Choosing an option to check/uncheck checkboxes not working?

I have a dropdown of users with different permissions. The different permissions for the users are view, edit or delete. When choosing the user from the dropdown, the checkboxes should update according to which permissions they have. I've tried…
triplethreat77
  • 1,276
  • 8
  • 34
  • 69
0
votes
1 answer

jQuery - Reset radio buttons on click

jsfiddle http://jsfiddle.net/cCBUh/2/ Information I have 3 choices. Only click on the labels, not on the radio buttons. When clicking on the different labels, different radio buttons are checked. In the console it says "clicked" when ever a label…
Jens Törnell
  • 23,180
  • 45
  • 124
  • 206
0
votes
3 answers

If clicking something else - change prop / jQuery

if clicking something else, the last input (which was clicked) should be readonly -> true again. here is my code: