Reputation: 8628
I have a JavaScript function that grabs the div container with the class "form-row".
The HTML below is a simplified version, but is the same structure as the nested elements i'm using.
<div class="form-row">
<label></label>
<div class="content">
<input></input>
</div>
</div>
I need to be able to grab the input within this container, and i'm having trouble doing so.
I've tried the following :-
var x = item.Next('input');
x.prop("checked",false);
But its not working.
How can i traverse the elements until i reach the input ans set its properties.
I only want to look at elements within this container.
Upvotes: 0
Views: 63
Reputation: 133403
item is a javascript object that has represents the div with class "form-row", you need .find()
Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
var x = item.find('input');
Upvotes: 1
Reputation: 978
This should do the trick $('.form-row').find('input').prop('checked', 'checked')
Upvotes: 1