Reputation: 89
I am having issue with UI manipulation:
I have this code:
var View = Backbone.View.extend({
el : '[data-container]',
ui : {
something : '[data-something]'
},
Then I can use:
this.ui.something.show().
This is plain jQuery selector, which will disable all input elements within the div.
$("#something :input").attr("disabled", true);
I am trying to do the same thing using this.ui selector, but how do I pass :input
?
If I use
this.ui.something.attr("disabled", true);
it disables the div, but not the elements inside it.
Some ideas?
Upvotes: 2
Views: 71
Reputation: 2278
Assuming an element actually has a data attribute of data-something
, $('input',this.ui.something).attr(...)
should work. All that is doing is finding all inputs inside elements that have data-something attribute
http://jsfiddle.net/sailorob/pvntR/
Edit: Just to clarify further, comma delimiter in the selector like jQuery(el1,el2)
is the same as using jQuery(el2).find(el1)
;
Upvotes: 2
Reputation: 2560
That selector is not correct, it should be $("#something input")
and this selector should work in the View too
Upvotes: 0