Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Need help resolving javascript conflict

Posted on 2011-10-31
7
Medium Priority
?
406 Views
Last Modified: 2012-05-12
I have the following 2 javascript functions (below)  that are conflicting with one another.  I was wondering how I might re-write Script #2 so that it doesn't conflict with Script #1.  Please advise.

Thanks,
- Yvan

-----------------------------------

SCRIPT #1 - JQUERY BASED TABLE SORTER JS LIBRARY

<script>
$(document).ready(function() { $("#vseo_report").tablesorter({} );})
</script>

-----------------------------------

SCRIPT #2- CUSTOM - SHOWS AND HIDES A LAYER ONCLICK

<script>
function $(id) {                  
      return document.getElementById(id);                  
      }
</script>

EXAMPLE USAGE:

<a href="javascript:var%20f=$('changeCampaignNameForm');%20f.style.display=(f.style.display=='block'?'none':'block');%20%20/*%20$('campaignname').focus();%20*/%20void%200;">Edit</a>
0
Comment
Question by:egoselfaxis
  • 4
  • 3
7 Comments
 
LVL 83

Expert Comment

by:leakim971
ID: 37057185
<script>
function blabla(id) {                  
      return document.getElementById(id);                  
      }
</script>

EXAMPLE USAGE:
<a href="javascript:var%20f=blabla('changeCampaignNameForm');%20f.style.display=(f.style.display=='block'?'none':'block');%20%20/*%20blabla('campaignname').focus();%20*/%20void%200;">Edit</a>
0
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 37057191
<script>
function blabla(id) {                  
      return document.getElementById(id);                  
      }
</script>

EXAMPLE USAGE:
<a href="javascript:var%20f=blabla('changeCampaignNameForm');%20f.style.display=(f.style.display=='block'?'none':'block');%20%20/*%20blabla('campaignname').focus();%20*/%20void%200;">Edit</a>
0
 

Author Comment

by:egoselfaxis
ID: 37057231
Thanks -- but I'm getting the following javascript error:

f.style is undefined

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 83

Expert Comment

by:leakim971
ID: 37057324
check your code is up to date on all your link : blabla instead $
0
 

Author Comment

by:egoselfaxis
ID: 37057350
This is what I have:

<a href="javascript:var%20f=$('changeCampaignNameForm');%20f.style.display=(f.style.display=='block'?'none':'block');%20%20/*%20$('campaignname').focus();%20*/%20void%200;">Edit</a>
0
 
LVL 83

Expert Comment

by:leakim971
ID: 37057369
check again my second post ID:37057191
0
 

Author Comment

by:egoselfaxis
ID: 37057406
Nevermind ... I had 2 intances of the of the triggering funciton link in my code, . and was testing the one that I hadn't updated.

It is working for me now -- thank you!

- Yvan
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question