Sometimes I pass an “object” in jQuery, and not in an identifier or other selectors. for instance
<input type="text" onclick="doit(this)" />
<script type="text/javascript">
function doit(e) {
var a = $(e).val();
}
This is useful when identifiers are not convenient, for example, long lists of elements or dynamically created input fields. I really saw examples of passing an object. I just tried it and it works.
My question is: can I combine the object selector with other selectors, for example, with identifiers. therefore instead of:
$("#myDiv .myClass").something()
I would not know how to encode it - something like this could be:
$(e + " .myclass").something
thank
sdfor source
share