I working on this code currently
var cctypeid = $(this).attr("id");
var data = $.parseJSON($("#"+cctypeid+"-id").val());
$.each(data, function (index, item) {
});
Inside the .each()
I need to populate the form field indicated by index
.
Two questions:
1) Is something like this more efficient $("#myForm #myField")
than $("#myField")
in this scenario or any scenario for that matter?
2) If I do the former, but want to cache $("#myForm)
with var _myform = $("#myForm)
how do I then write the call? Does the caching in this scenario make sense?
Ok, more than 2 questions.
Thanks,
Derek
$("#myField", _myform)
.$("#myField")
>$("#myForm #myField")