How can I this to jquery instead of it being javascript?
function showMssg() {
var message = document.getElementsByTagName('pre')[0];
var console = document.getElementById('console');
if (message.style.display == 'block') {
log += '
The log is now hidden.
';
message.style.display = 'none';
console.innerHTML = 'Show Console Log';
} else {
log += '
The log is now visible.
';
message.innerHTML = log;
message.style.display = 'block';
console.innerHTML = 'Hide Console Log';
}
}
Below is the jquery code along with output which i have checked.
function showMssg() {
var log = '';
var message = $('pre')[0];
var console = $('#console');
if (message.style.display == 'block') {
log += ' The log is now hidden. ';
message.style.display = 'none';
console.html('Show Console Log');
} else {
log += 'The log is now visible. ';
message.innerText = log;
message.style.display = 'none';
console.html('Hide Console Log');
}
}
output :

How can I this to jquery instead of it being javascript? function showMssg() { var message...
This question relates to Javascript. Could you please show me why my code is not working? I want to create 2 text boxes and have the user enter something into both of them. If the text entered into both boxes is identical the a green message is made visible. If the boxes are different a red message is made visable. Please keep it simple because I am new to javascript. <html> <head> <title></title> <script>...
This question relates to Javascript. Could you please show me why my code is not working? I want to create 2 text boxes and have the user enter something into both of them. If the text entered into both boxes is identical the a green message is made visible. If the boxes are different a red message is made visable. Please keep it simple because I am new to javascript. <html> <head> <title></title> <script>...
I have some code for HTML/Javascript but I need to change it up a bit. Heres the assignment and what I have. The part in the bold is what I need help with. I need a button called new timer for when it reaches zero... Thank you. Assignment For this assignment, you will write a timer application in HTML and JavaScript. Your HTML document should contain the following elements/features: HTML tags: An <input> tag labeled "Timer Duration" with the initial...
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>...
I created an Html with tabs, then how do I import the constant character content of a JS into one of these tabs without editing that JS file? here is my page: <!DOCTYPE html> <html> <body> <div id="main"> <span class="tab"> <button class="current">News</button> <button>Create</button> <button onclick="about()">About</button> <button>Login</button> </span> <div class="con" style="display: block"> For news content</div> <div class="con">For create content</div> <div class="con" id="about">For about content</div> </div> </body> <script type="text/javascript" src='strings.js'></script> <script> var box = document.getElementById('main'); var btns = document.getElementsByTagName('button'); var divs =...
Question about JS form validation: I want to check these two input (name, question) with one function validateText. But how can I pass the input to the function, I did this but not working. javascript part: question = document.getElementById("question"); question.addEventListener("input", validateText); pname = document.getElementById("name"); pname.addEventListener("input", validateName); validateText function: function validateText(e) { var message = ""; var elem_name = e.name; if (e.value.length == 0) { message = "You must enter a" + elem_name + "!";} else if (e.validity.tooShort) { message =...
NEED HELP with HTML with Javascript embedding
for form validation project below. I have my code
below but I'm stuck with validation. If anyone can fix it, I'd
really appreciate.
******************************************************************************
CODE:
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project
Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Nice</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<script>
var textFromTextArea;
function getWords(){
var text =...
for Javascript, JQuery
When the page is first opened a user will see the name field and the
three vacation images to the left of the page. The page
should behave according to the following rules.
1. When a user's mouse pointer goes over any image, that image's
border will change to be "outset 10px" and when the mouse pointer
leaves that image it's border will change to "none".
2. When the user clicks a "Vacation" image on the left,...
Javascript on implementing dynamic calculation using a form. How do I get the text in the yellow box to display "You can play FGO!" when all yeses are checked, or "You cannot play FGO!" otherwise? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Form</title> <link rel="stylesheet" href="css\survey.css"> <script src="js\survey.js"></script> </head> <body> <form id="part1"> <fieldset> <legend>Can you play FGO?</legend> <p>Do you have a smartphone?: ...
Fake News This exercise is about modifying the content of a page in your web browser using Javascript. As we have said, Javascript has access to the current page via the Document Object Model or DOM. In your browser, the variable document represents the current document and your code can use it to read and write to the current page. In this exercise we will use the developer tools Javascript console to write Javascript to access parts of the main...