Reputation: 71
I have this jquery function.It is working fine and bringing the data when i click at any particular character. If i click "A" then it bring all the places starting with A.But i want to load all the countries at once irrespective of any character click if i write some condition.
jQuery(function ($) {
alert(1);
// Listen for Click
$(".serving-nav a").click(function (e) {
// Get the Character
var theChar = $(this).data('alpha');
// Hide Others
$(this).parent().find('a').not($(this)).removeClass('active');
$(".serving-data .serving-nav-data").stop(true, true).slideUp(500);
// Show the Related
$(this).addClass('active');
$(".serving-data .serving-nav-data[data-alpha='" + theChar + "']").stop(true, true).slideDown(500);
// Prevent Default
e.preventDefault();
return false;
});
// Trigger Click on Active One
$(".serving-nav a.active").click();
});
Upvotes: 0
Views: 34
Reputation: 37803
It looks like you'd just do:
$(".serving-data .serving-nav-data').show();
Or, if you still want them animated:
$(".serving-data .serving-nav-data').stop(true, true).slideDown(500);
Basically, if you don't want to select based on the data-alpha
property, just don't include that selector.
Upvotes: 1