获取ul下li标签里点击的是哪一个li并获取li里a标签的值

$("ul li").click(function(){
    //获取当天月份
    var month_string =  $(this).find("a").eq(0).text();
    var month = month_string.substring(0,1)
    alert(month);
           
 });
doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="telephone=no" name="format-detection">
<title>xxxxxxtitle>
<link rel="stylesheet" type="text/css" href="../css/public_sale.css">
<link href="../css/basic_business_layout.css" rel="stylesheet" type="text/css">
<link href="../css/basic_business.css" rel="stylesheet" type="text/css">
<script>!function(n,e){var t=n.documentElement,i="orientationchange"in window?"orientationchange":"resize",o=function(){var n=t.clientWidth;n&&(t.style.fontSize=(n/320*10).toFixed(0)+"px")};o(),n.addEventListener&&e.addEventListener(i,o,!1)}(document,window);
script>

<script language="javascript" src="../js/navigator/menuswitch.js">script>


<link rel="stylesheet" type="text/css" href="../css/widget/navigator/navigator.css" />
<link rel="stylesheet" type="text/css" href="../css/widget/navigator/navigator.iscroll.css" />
<link rel="stylesheet" type="text/css" href="../css/widget/navigator/navigator.default.css" /> 


<script type="text/javascript" src="../js/navigator/zepto.js">script>
<script type="text/javascript" src="../js/navigator/zepto.extend.js">script>
<script type="text/javascript" src="../js/navigator/zepto.ui.js">script>
<script type="text/javascript" src="../js/navigator/zepto.iscroll.js">script>
<script type="text/javascript" src="../js/navigator/widget/navigator.js">script>
<script type="text/javascript" src="../js/navigator/widget/navigator.iscroll.js">script>


head> 

<body>

 <header>
  <a href="#" class="posit_ico headback_ico headLeft" id="back_id">a>
  <a href="#" class="posit_ico headRight">a>
  <h1><a href="#">发展用户收入查询a>h1>
 header>
 <section class="content">
  
  <div class="ui-date-nav">
   <div class="ui-date-list" id="nav-smartSetup">
    <ul class="fixed">
     <li><a href="#" class="ui-date-day">9月a>li>
     <li><a href="#" class="ui-date-day">8月a>li>
     <li><a href="#" class="ui-date-day">7月a>li>
     <li><a href="#" class="ui-date-day">6月a>li>
     <li><a href="#" class="ui-date-day">5月a>li>
     <li><a href="#" class="ui-date-day">4月a>li>
     <li><a href="#" class="ui-date-day">3月a>li>
     <li><a href="#" class="ui-date-day">2月a>li>
     <li><a href="#" class="ui-date-day">1月a>li>
    ul>
   div>
  div>
  
  
  <div class="search-result">
   <div class="ui-fold-list">
    <div class="ui-fold-show"><a href="#">用户收入汇总a><i class="posit_ico listArrowB_ico">i>
    div>
    <div class="ui-fold-inner" style=" display:block;">
     <div class="fixed user-bill-total">
      <dl><dd>500000.0dd><dt>当月实收金额dt>dl>
      <dl><dd>245000.0dd><dt>账户应收dt>dl>
     div>
     <div class="user-bill-other">
      <dl><dt>户均消费dt><dd>50.0元dd>dl>
      <dl><dt>新增欠费dt><dd>10000.0元dd>dl>
      <dl><dt>上月欠费补扣dt><dd>500.0元dd>dl>
      <dl><dt>在网激活用户dt><dd>50人dd>dl>
      <dl><dt>活跃消费用户dt><dd>1000人dd>dl>
     div>
    div>
   div>
   <div class="ui-fold-list">
    <div class="ui-fold-show"><a href="#">海聊37套餐a><i class="posit_ico listArrowB_ico">i>
    div>
    <div class="ui-fold-inner" style=" display:none;">
     <div class="fixed user-bill-total">
      <dl><dd>500000.0dd><dt>当月实收金额dt>dl>
      <dl><dd>245000.0dd><dt>账户应收dt>dl>
     div>
     <div class="user-bill-other">
      <dl><dt>户均消费dt><dd>50.0元dd>dl>
      <dl><dt>新增欠费dt><dd>10000.0元dd>dl>
      <dl><dt>上月欠费补扣dt><dd>500.0元dd>dl>
      <dl><dt>在网激活用户dt><dd>50人dd>dl>
      <dl><dt>活跃消费用户dt><dd>1000人dd>dl>
     div>
    div>
   div>
   <div class="ui-fold-list">
    <div class="ui-fold-show"><a href="#">海聊57套餐a><i class="posit_ico listArrowB_ico">i>
    div>
    <div class="ui-fold-inner" style=" display:none;">
     <div class="fixed user-bill-total">
      <dl><dd>500000.0dd><dt>当月实收金额dt>dl>
      <dl><dd>245000.0dd><dt>账户应收dt>dl>
     div>
     <div class="user-bill-other">
      <dl><dt>户均消费dt><dd>50.0元dd>dl>
      <dl><dt>新增欠费dt><dd>10000.0元dd>dl>
      <dl><dt>上月欠费补扣dt><dd>500.0元dd>dl>
      <dl><dt>在网激活用户dt><dd>50人dd>dl>
      <dl><dt>活跃消费用户dt><dd>1000人dd>dl>
     div>
    div>
   div>
   <div class="ui-fold-list">
    <div class="ui-fold-show"><a href="#">海聊77套餐a><i class="posit_ico listArrowB_ico">i>
    div>
    <div class="ui-fold-inner" style=" display:none;">
     <div class="fixed user-bill-total">
      <dl><dd>500000.0dd><dt>当月实收金额dt>dl>
      <dl><dd>245000.0dd><dt>账户应收dt>dl>
     div>
     <div class="user-bill-other">
      <dl><dt>户均消费dt><dd>50.0元dd>dl>
      <dl><dt>新增欠费dt><dd>10000.0元dd>dl>
      <dl><dt>上月欠费补扣dt><dd>500.0元dd>dl>
      <dl><dt>在网激活用户dt><dd>50人dd>dl>
      <dl><dt>活跃消费用户dt><dd>1000人dd>dl>
     div>
    div>
   div>
   <div class="ui-fold-list">
    <div class="ui-fold-show"><a href="#">海聊117套餐a><i class="posit_ico listArrowB_ico">i>
    div>
    <div class="ui-fold-inner" style=" display:none;">
     <div class="fixed user-bill-total">
      <dl><dd>500000.0dd><dt>当月实收金额dt>dl>
      <dl><dd>245000.0dd><dt>账户应收dt>dl>
     div>
     <div class="user-bill-other">
      <dl><dt>户均消费dt><dd>50.0元dd>dl>
      <dl><dt>新增欠费dt><dd>10000.0元dd>dl>
      <dl><dt>上月欠费补扣dt><dd>500.0元dd>dl>
      <dl><dt>在网激活用户dt><dd>50人dd>dl>
      <dl><dt>活跃消费用户dt><dd>1000人dd>dl>
     div>
    div>
   div>
   
  div>
  
 section>
<script type="text/javascript">
    (function () {
        /*组件初始JS*/
        $('#nav-smartSetup').navigator();    //smart setup方式创建 推荐方式
    })();
script>

<script language="javascript">
    /*折叠菜单JS*/
    var mSwitch = new MenuSwitch("ui-fold-list");
    mSwitch.setDefault(0);
    mSwitch.setPrevious(false);
    mSwitch.init();
script>
body>

html>

然后就可以获取相应的点击的是那个月份了

获取ul下li标签里点击的是哪一个li并获取li里a标签的值_第1张图片

 

你可能感兴趣的:(获取ul下li标签里点击的是哪一个li并获取li里a标签的值)