Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

problem with prepend

Posted on 2012-04-01
1
Medium Priority
?
254 Views
Last Modified: 2012-04-01
Hi I am getting a syntax error when trying to do this:

$butt =$('<button id="inv" onclick= "document.location.href = 'http://www.google.com';">  Inv  </button>');
		 
		 $('#exbuttons').prepend($butt);

Open in new window

0
Comment
Question by:Rozamunda
1 Comment
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 37794239
escape the single quote inside your string (arround http://www.google.com) :

$butt =$('<button id="inv" onclick= "document.location.href = \'http://www.google.com\';">  Inv  </button>');

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

916 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