Bacho sh Bacho sh - 1 year ago 113
Javascript Question

error on window.location.hash

i have rails app where i modify some files and then run bundle instal and assets:precompile.

after that i have error in file wich was not changed.
part of file where error happened:

<script type="text/javascript">
function openCurrentTab() {
var hash = window.location.hash || '#info'
$('a[href=' + hash + ']').tab('show')

$(function() {

$('#outage-tabs > li > a').click(function(evt) {
history.pushState(null, null, this.hash)
window.onpopstate = openCurrentTab

error (in console)

application-76c7fea….js:24 Uncaught Error: Syntax error, unrecognized expression: a[href=#info]

thank for help

Answer Source

Seems you have errors in your jQuery search

$('a[href=' + hash + ']').tab('show')

Use end-with selector and next syntax: do not use # inside term, use '' for setting search term


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download