Solved

Javascript Alert does not work

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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 embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

777 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