Solved

Javascript Alert does not work

Posted on 2011-03-11
2
257 Views
Last Modified: 2012-05-11
What is wrong with the alert below? If I replace the alert with just the text "TEST" - it works.
With 'document.getElementById("sort-order").value' the alert doesn't even pop up.
<form id="filter-sort-block" action="http://www.artechchurchinteriors.com/portfolio/" method="get" class="no_js">
	<fieldset id="sort">
		<select name="order" id='sort-order'>
			<option value='name' selected="selected" >Alphabetical</option>				
		</select>
		<input type="submit" value="Sort" class="submit" />
	</fieldset>
			
<script type="text/javascript" charset="utf-8">
	alert("document.getElementById("sort-order").value");
</script>

</form>

Open in new window

0
Comment
Question by:dnotestine
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
double quotes inside double quotes, you need to escape them :
alert("document.getElementById(\"sort-order\").value");

Open in new window


But it seems you want to achieve this :
alert(document.getElementById("sort-order").value);

Open in new window

0
 

Author Closing Comment

by:dnotestine
Comment Utility
Thank you very much
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Joomla Website Malfunction 9 47
Create a new template 9 20
Problem to page 4 11
Fixing my modal from bootstrap 14 0
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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 …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now