Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have this ul in my form

<form action="step1/" method="post" enctype="multipart/form-data" id="form">
    <div class="tabs">
        <ul>
            <li class="dot clicked radio_buttons"></li>
            <li class="active not_the_dot"><span class="l"></span><a href="#">Standard Class</a><span class="r"></span></li>
            <li class="dot radio_buttons"></li><li class="not_the_dot"><span class="l"></span><a href="#">Business Class</a><span class="r"></span></li>
            <li class="dot radio_buttons"></li><li class="not_the_dot"><span class="l"></span><a href="#">Premium</a><span class="r"></span></li>
        </ul>
....
....
....

and then i have other items in the form as well like

 <select name="quantity_id" class="quantity_select">
            <option selected="selected" value="0">SELCT STATION QUANTITY</option>
            <option value="1">1 Station</option>
            <option value="2">2 Station</option>
            <option value="3">3 Station</option>
            <option value="4">4 Station</option>
            <option value="5">5 Station</option>
    </select>

and on the form submit the quantity_id is present but the ul value is not ....is there something i need to change to make this value available....basically i need the "active" class text like Standard, business

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
330 views
Welcome To Ask or Share your Answers For Others

1 Answer

<ul/> items are not form elements and will not be posted when the form is submitted. If you need to capture these values you can store them in a hidden form element.

Example to capture the text into a hidden field, add a hidden field.

<input type="hidden" id="activeThing" name="activeThing"/>

And bind a click event to the li:

$("ul li.not_the_dot").click(function(){
  $("#activeThing").val($(this).find("a").text());
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...