duanhuo0577
2017-01-04 11:04
浏览 73
已采纳

如何在jquery中获得UL LI值?

I am trying to get ul li listbox value in function but i cant find way.

My code is like that.

<ul class="dropdown-menu" id="newloc">
    <?php
    $res_add = DB::table('res_br')->where('email',$user_email->email)->get();

    if(count($res_add) != "") {
        foreach($res_add as $rr1) { 
        ?> 
            <li value="<?= $rr1->street;?>"><?= $rr1->street;?></li>
        <?php    
        }
    }
    ?>
</ul>

<button type="button" class="btn btn-block btn-primary" data-dismiss="modal" onClick="buildorder()" >Build Your Order</button>

My jquery function is like that

function buildorder() {
    var radio =   $("input[name='newradio']:checked").val();
    var location = $(this).find('li');

    console.log(li.text());
    alert(radio);
    alert(location);
}

can some help me.to get location variable.

2条回答 默认 最新

相关推荐 更多相似问题