Is there any way I can simplify this inefficient piece of JavaScript?
$(function () {
var $carousel = $('#carousel');
var $switch = $('#switch');
var $header = $('#header');
var $submit = $('#submit');
$carousel.bind('slid', function() {
var index = $('#carousel .item').index($('#carousel .carousel-inner .active'));
if (index == 0) {
$header.text('Sign In');
$switch.text('Sign Up');
$submit.text('Sign In');
$submit.attr('form', 'sign_in');
} else {
$header.text('Sign Up');
$switch.text('Sign In');
$submit.text('Sign Up');
$submit.attr('form', 'sign_up');
}
});
});
$
stands forjQuery
? \$\endgroup\$