reverseLogic[i].value.indexOf("data-countrycode=" + "''"+ val +"''")
jQuery(function($) {
var reverseLogic = [];
$("#StateId option:gt(0)").each(function(i, v) {
reverseLogic.push({ value: $(this).val(), text: $(this).text() });
});
$("#CountryId").change(function() {
var putAllBack = $(this).prop("selectedIndex") == 0;
var val = $(this).val();
$("#StateId option:gt(0)").remove();
for (var i = 0; i < reverseLogic.length; i++) {
if (putAllBack || reverseLogic[i].value.indexOf("-" + val) > 0) {
$("#StateId").append("<option value='" + reverseLogic[i].value + "'>" + reverseLogic[i].text + "</option>");
}
}
}).change();
});
<select data-val="true" id="CountryId" name="CountryId"><option value="Selects items">Country*</option>
<option value="25">Canada</option>
<option value="126">United States</option>
</select>
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.