Solved

Javascript Alert does not work

Posted on 2011-03-11
2
260 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
ID: 35112840
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
ID: 35113001
Thank you very much
0

Featured Post

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
email validation 9 47
Given a github repo find email address of all collaborators in that repo 1 29
Use Mid in Html 6 21
Echo'd values in dropdowns 6 27
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

713 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