Javascript + HTML, no JQuery please.
So, Im trying to figure out how to send an alert if the value of my selection is "0". I will be using this for a validation form assignement. So if the user leaves the selection on the default "0" value I can prompt the user to pick a valid option which would be 1+. Not sure how to access this value.
Example code below:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Form Validation</title> <link rel="stylesheet" href="css/style.css"> <script> var selectedValue=document.getElementById('mySelect'); function checkForm() { if(selectedValue.value=='0') alert('asd'); } </script> </head> <body> <select id='mySelect'> <option value="0">-</option> <option value="1">this is 1 </option> <option value="2">this is 2 </option> <option value="3">this is 3 </option> </select> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Form Validation</title> <script> function checkForm() { // getting the selected value var x = document.getElementById("mySelect").value; if (x === "0") { alert("slect another option apart from 0 "); // setting the slection to default document.getElementById("mySelect").selectedIndex = "1"; } } </script> </head> <body> <p>Select a option the list.</p> <select id="mySelect" onchange="checkForm()"> <option value="0">this is 0 <option selected="selected" value="1">this is 1 <option value="2">this is 2 <option value="3">this is 3 </select> </body> </html>
Javascript + HTML, no JQuery please. So, Im trying to figure out how to send an...
HTML: ch14 IC_1B - use a fadeToggle to control jQuery to show the second part of the content on Chp 14 slide 33. <!DOCTYPE html> <html lang="en"> <head> <title> jQuery </title> <meta charset="utf-8"> <style> #details { display: none; } </style> <xxxx src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></xxxx> </head> <body> <h1>jQuery</h1> <p>Many websites, including Amazon and Google, use jQuery, to provide interaction and dynamic effects on web pages. <a href="#" id="more">...
I am trying to create a slide show using JavaScript. This is what I have so far: HTML: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Slide Show</title> <link rel="stylesheet" href="main.css"> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <script src="slide_show.js"></script> </head> <body> <section> <h1>Fishing Slide Show</h1> <ul id="image_list"> <li><a href="images/casting1.jpg" title="Casting on the Upper Kings"></a></li> <li><a href="images/casting2.jpg" title="Casting on the Lower Kings"></a></li> <li><a href="images/catchrelease.jpg" title="Catch and Release on the Big Horn"></a></li> <li><a href="images/fish.jpg" title="Catching on the South Fork"></a></li> <li><a href="images/lures.jpg" title="The Lures for Catching"></a></li> </ul>...
JAVASCRIPT/JQUERY Hello I would like some help understanding jQuery. Here are the directions: Write a program that creates the following table: Course Course Name Day Time IMS115 Windows 10 Monday 6 PM IMS215 Office 2016 Wednesday 5 PM MIS200 Java Thursday 9 AM MTH105 Business Math Saturday 10 AM Using jQuery, select every other odd row and change the font color to blue and make it bold. And here is my code: Chapter4.html <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="Chapter4.css">...
Hello Ive been tryting to add the CDN of jquery to my html code and I keep getting an error Need help with this : Navigate to www.code.jquery.com in your Chrome browser. On this page, you'll find different stable versions of jQuery. Select uncompressed for jQuery Core 3.3.1. Copy the <script> tag that is given to you. In store_hours.html, paste that tag directly above your body's closing tag. This is the jQuery CDN. After you paste this code into...
Using form events functions to answer this question. Use the attached form html file which contains 2 html radio buttons. When the first choice is chosen, display the text ”First” under the first choice. When the second choice is chosen, display the text ”Second” under the second choice. Instead of using JavaScript complete this question using JQuery <!DOCTYPE html> <html> <head> <title>midterm exam</title> <link rel="stylesheet" href="css/q1.css" /> </head> <body> <div id = "page"> <form> ...
I am trying to make it so that radio buttons when clicked execute a javascript file. I have to to have the exercises in external files. Here is what I have so far. I am reusing a script that was used to make radio buttons switch CSS files so I think I have to change the set attribute options. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <p> 4.2 Output: The first 20 Fibonacci numbers, which are...
I have to make a pixel art maker using javascript. HTML and CSS were already provided. I only had to do the JavaScript part. Every time I run the HTML folder nothing happens when I choose the width, height, and color. This is my code: (ONLY JS IS SUPPOSED TO BE FIXED). JS: // Select color input // Select size input const colorPicker = document.getElementsById('colorPicker'); const rowNum = document.getElementsById('inputHeight'); const cellNum = document.getElementById('inputWidth'); const pixelCanvas = document.getElementById('pixelCanvas'); const form =...
I need help with my javascript project, I've started on it but I can't seem to get ym java scripts to work with my index.html. Can someone please help me fix my code? I need the main.js & scratchpad.js to work with my index.html .Thank you Directions: Go to the following link: https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/JavaScript_basics On that page, scroll down to "A 'hello world' example". Follow the step-by-step instructions to download their code and edit it in your text editor of choice....
I'm having trouble to link the .js file to the html so changes for the html to be made in the .js file <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>:JavaScript, HTML and jQuery</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- this is so I don't have to give you a separate CSS file --> <style> .hidden {display: none;} .menu { width: 100px;} </style> </head> <body> <div class="container"> <h1>Assignment 2: JavaScript, HTML and jQuery</h1> <p>To complete this...
Trying to understand java script.. The code provided prints out a game board of cells that are 10 x 10. I currnetly have it printed out so that it will print out pink squares. how can i create a click even on any of the pink squares that when they are clicked it will turn the square black... then any square that is black when it is clicked it will change back to the color pink html/js code and css...