i have a string as – 0-100
which is i am trying to split as 0 and 100
i have tried using jquery
$("#costFilter li a").click(function () {
var temp = $(this).html().split("- ");
var temp1 = temp.split("-");
alert(temp1[0]);
alert(temp1[1]);
// $("#<%=initialCost.ClientID%>").val(temp1[0]);
// $("#<%=endCost.ClientID%>").val(temp1[1]);
// $("#<%=BtnCostFilter.ClientID %>").click();
});
which doesn’t work.
My html as:
<ul style="list-style-type: none" id="costFilter">
<li><a href="#.">- 0-100</a> </li>
<li><a href="#.">- 100-200</a> </li>
<li><a href="#.">- 200 - 300</a> </li>
<li><a href="#.">- 400-500</a> </li>
<li><a href="#.">- 600-600</a> </li>
</ul>
no alert is working. Thanks for any assistance.
you split the
html()with ‘- ‘ so your real value is intemp[1]tyr this
fiddle here