Created
June 17, 2013 21:50
-
-
Save adrianrodriguez/5800805 to your computer and use it in GitHub Desktop.
physicians.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('li.physician').each(function(){ | |
var web = $(this).children('.physician_web').text(); | |
var shortText = jQuery.trim(web).substring(0, 50) | |
.trim(this) + "..."; | |
var address = $(this).children('.physician_address').text(); | |
address = address.replace(/\s{2,}/g, ' '); | |
address = address.replace(/ /g, '+'); | |
$(this).children('.physician_web').attr('href', 'http://' + web); | |
$(this).children('.physician_address').attr('href', 'http://maps.google.com/maps?q=' + address); | |
if (web.length > 49) { | |
$(this).children('.physician_web').text(shortText); | |
}else if (web.length < 1) { | |
$(this).children('.physician_web').parent().children().hide(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment