I have a form application. I need to access an input object. I can not add this attribute.
i am getting error :
Uncaught TypeError: Property 'children' of object # is not a function scripts.js:106 (anonymous function) scripts.js:106 x.event.dispatch jquery.js:4597 y.handle
elm[6].children() = Not null
t[0].value = Have a value.
$(".demo").delegate(".configuration .dropdown-menu button", "click", function (e) {
e.preventDefault();
var t = $(this).parent().children();
var elm = t.parent().parent().parent().parent().parent().children().children();
debugger;
if (t[1].id == "Id") {
elm[6].children().attr('id', t[0].value);
}
})
I can see input object details. But i cannot add attribute..
t.parent().parent().parent().parent().parent()witht.closest("selector"). Your JS is very brittle to the slightest HTML change. Also, probably what you want ist.closest("some selector").find("some other selector")so you're not hard coding specific HTML positions into your JS.