Solved

Javascript Alert does not work

Posted on 2011-03-11
2
262 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
object method as an event handler 8 71
Jquery Calculation 3 37
Presenting my portfolio on the web? 11 50
Div not showing up 6 31
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
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…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
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…

739 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