Q:

How do I set a variable equal to the value of an attribute within a child element?

I am attempting to set a variable equal to the value of the name of a form in the following html.
<div id="someid">
    <form name="somename">
    </form>
</div>

Here I have tried to set var x equal to the name of the form but I don't think I'm going about this correctly.
$(document).ready(function(){
    if($("#someid").length > 0){
         var x = $($("#someid").children("form")).attr("name");
        if(x !== undefined){
            alert(pkmnId);
        }
    }
});

A:

Only problem with this line 
var x = $($("#someid").children("form")).attr("name");

is that you are passing a jquery object to the jquery method where either a DOM element is expected or a selector is expected.
change is to
var x = $("#someid").children("form").attr("name"); //observe removing extra $ from the beginning.

