Vote count:
0
I'm new to JQuery. In my App I have the following:
My HTML code is here..
<ul id="list">
<li>
<a class="selected" value="0" href="#" id="sel">ALL</a>
</li>
<li>
<a href="#" value="1">1+</a>
</li>
<li>
<a href="#" value="2">2+</a>
</li>
<li>
<a href="#" value="3">3+</a>
</li>
<li>
<a href="#" value="4">4+</a>
</li>
<li>
<a href="#" value="5">5+</a>
</li>
</ul>
My CSS code is here..
.selected{background-color:green;}
My JQuery code for getting the selected list value is here..
$(document).ready(function () {
$('#list li a').click(function () {
var new = $(this).attr("value");
$("#hdn_list").value = new; //passing the new selected values to hidden control
$('#list li a').removeClass('selected');
$(this).addClass('selected');
return false;
});
});
When i am clicking the submit button it is redirected to next page.. if i back to this page again it must pre fill the selected value using that hidden control(#hdn_list) value and the css style also must apply that selected value.. how to do this through jquery/javascript? thanks in advance.
asked 38 secs ago
Aucun commentaire:
Enregistrer un commentaire