我基本上都试图完成主题所暗示的内容,但我在警报中得到"未定义",我不完全确定原因.我对jquery相当新,所以,我可能有错误的语法,但不知道从哪里开始.我将发布我的两次尝试,这两次尝试都会在警报中产生"未定义"...
//In my first attempt, I'm trying to get the id of the inner a tag
<ul>
<li id="l1" class="active"><a href="#c1">Samp 1</a></li>
<li id="l2" class=""><a href="#c2">Samp 2</a></li>
<li id="l3" class=""><a href="#c3">Samp 3</a></li>
</ul>
var selected = $(".active).children("a").attr("id");
alert(selected);
//In my second attempt, I'm trying to get the id of the currently selected li
var selected = $(".active").attr("id");
alert(selected);
Run Code Online (Sandbox Code Playgroud) 尝试按升序对memnum下面的数组进行排序,我有点困惑哪个更好用... usort或array_multisort?我在想,因为它是多维的?有没有人有这样的例子?
Array
(
[0] => Array
(
[memnum] => 3236467423
[mid] => 1104881300
[fname] => JOHN
[lname] => DOE
[add1] => OMITTED
[add2] =>
[city] => CHESTERFIELD
[state] => MI
[zip] => 48051
[age] => 50
)
[1] => Array
(
[memnum] => 3258467922
[mid] => 1105121457
[fname] => JANE
[lname] => DOE
[add1] => OMITTED
[add2] =>
[city] => CHESTERFIELD
[state] => MI
[zip] => 48051
[age] => 50
)
[2] => Array
(
[memnum] => 3237769108
[mid] …Run Code Online (Sandbox Code Playgroud)