cfpb / consumerfinance.gov

Django project protecting American consumers
https://www.consumerfinance.gov/
Creative Commons Zero v1.0 Universal
277 stars 112 forks source link

JS error on post pages #98

Closed himedlooff closed 10 years ago

himedlooff commented 10 years ago

URL

Any post page like /blog/spring-2014-rulemaking-agenda.

Actual Behavior

I am getting the following JS error.

Uncaught TypeError: Cannot read property 'split' of undefined

Steps to Reproduce

Open a post page in Chrome and open up the console.

Screenshot

image

himedlooff commented 10 years ago

I'm pretty sure it's because the input split jQuery plugin options are trying to call split() on non-existent elements.

Scotchester commented 10 years ago

Yeah, your diagnosis is correct. How can we isolate this script to just the pages with these split input elements?

ascott1 commented 10 years ago

a simple fix might be to something like:

if ($('#split-elem').length > 0) { 
    // do plugin thing
}
himedlooff commented 10 years ago

Thanks @ascott1! I gave it a try and it's working great. :boom:

ascott1 commented 10 years ago

:dancers: