Solved

Javascript Alert does not work

Posted on 2011-03-11
2
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: 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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

729 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