Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Web Development Articles - Page 510 of 1049
135 Views
To add options to a , you need to use append(). Following is the JavaScript code −Example Live Demo Document Book TV var mySelection = new Option("Mobile", "Samsung Mobile"); $(mySelection).html("Samsung Mobile"); $("#selectCategory").append(mySelection); To run the above program, save the file name anyName.html(index.html) and right-click on the file and select the option open with live server in VS Code editor.Output
3K+ Views
For this, you need to use attr(). The attr() method can be used to either fetch the value of an attribute from the first element in the matched set or set attribute values onto all matched elements.Following is the JavaScript code −Example Live Demo Document $('#myURL').attr('value', 'http://www.facebook.com'); To run the above program, just save the file name anyName.html(index.html) and right click on the file and select the option open with live server in VSCode Editor.OutputLook at the above sample output the URL has been changed ... Read More
332 Views
For this, you need to use keyDown as well as preventDefault(). Following is the JavaScript code −Example Live Demo Document const pressEnter = (event) => { if (event.key === "Enter") { event.preventDefault(); } }; document.getElementById("disableDefaultTime").addEventListener("keydown", pressEnter); To run the above program , just save the file name anyName.html(index.html) and right click on the file and select the option open with live server in VSCode editor.OutputFollowing is the output. When you press Enter key nothing will be displayed.You need to use keyDown to get time as in the below screenshot −
14K+ Views
In order to disable future dates, you need to use maxDate and set the current date. Following is the JavaScript code −Example Live Demo Document The selected date is as follows: $(document).ready(function () { var currentDate = new Date(); $('.disableFuturedate').datepicker({ format: 'dd/mm/yyyy', autoclose:true, endDate: "currentDate", maxDate: currentDate }).on('changeDate', function (ev) { $(this).datepicker('hide'); }); $('.disableFuturedate').keyup(function () { ... Read More
7K+ Views
We can identify the nth sub element using xpath in the following ways −By adding square brackets with index.By using position () method in xpath.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class SubElement { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://www.tutorialspoint.com/index.htm"; driver.get(url); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); // xpath using position() targeting the first element with type text driver.findElement(By.xpath("//input[@type='text'][position()=1]")) ... Read More
394 Views
Each of the locators has some significance. If the page contains uniqueattribute values, we should use them first. However if there are no unique elements, we should use css selector as it is more effective in terms of speed.Css also has a drawback that we cannot traverse from child to parent node which means we cannot travel backward. But xpath allows this feature. Xpath is the most common locator in Selenium and performs traversal through DOM elements and attributes to identify an object.An xpath is represented by two ways namely ‘/ ‘and ‘// ‘. A forward single slash means absolute ... Read More
4K+ Views
Both ASP and ASP.NET are the widely used languages for application and mainly the frontEnd development. Both the languages used for dynamic generation of web pages. The content generated through server-side scripting is then sent to the client’s web browser.Following are the important differences between ASP and ASP.NET.Sr. No.KeyASPASP.NET1DefinitionASP or also popularly known as Classic ASP developed by Microsoft is first Server-side scripting engine which is used for dynamic generation of web pages.ASP.NET, on the other hand, is a server-side web framework, open-source, which is designed for the generation of dynamic web pages.2Language typeASP is interpreted language that means the ... Read More
9K+ Views
Both the Waterfall model and the V-Model are quite widely used development methodologies in the software industry. Both of these models help the development of applications in a systematic way. The basic difference between V-Model and Waterfall model is that, in the V-Model, defects are identified in the testing phase, while in the Waterfall model, defects are identified from the beginning. Read through this article to find out more about the V-Model and the Waterfall Model and how they are different from each other. What is V-Model? V-Model is the development model in which the entire model is ... Read More
2K+ Views
Both HTML and ASP are the web development languages and are widely used in developing web server pages and applications.On the basis of nature of both of the languages we can distinguish between HTML and ASP as follows −Sr. No.KeyHTMLASP1DefinitionHTML is a client-side language which mainly use for developing user interface.HTML stands for Hypertext MarkUp Language in which "Hypertext" refers to the hyperLinks that an HTML page may contain and "MarkUp language" refers to the way tags are used to define the page layout and elements within the page.On other hand ASP is a server-side language developed by Microsoft i.e., ... Read More
2K+ Views
To redirect to another webpage using JavaScript, the code is as follows −Example Live Demo Redirect to a Webpage Example Redirect Click the above button to Redirect to another Webpage document .querySelector(".redirectBtn") .addEventListener("click", redirectFunction); function redirectFunction() { location.href("https://tutorialspoint.com/"); } OutputThe above code will produce the following output −On clicking the “Redirect” button we will be redirected to a new site −