• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar

Pro Programming

Professional way of Programming: Learn C, C++, Java, Python, Dot Net, Android the professional way

  • Home
  • C MCQs
  • C/C++ Programs
  • Java Programs
  • C#
  • Python
  • MySQL
  • Topics
    • Arrays
    • Strings
    • Link Lists
    • Trees
    • Shapes
  • Projects
  • Articles
  • Games
You are here: Home / Archives for jQuery | css()

jQuery | css()

How to detect the user’s device using jQuery ?

Leave a Comment


The task is to determine the user’s device, whether it is iPad or not, using JQuery. Below are the required methods:

Example: This example uses the navigator.userAgent property to identify the user’s device.

<!DOCTYPE HTML>

<html>

<head>

<title>

JQuery

| Detect iPad users.

</title>

</head>

<script src=

</script>

<body style="text-align:center;"

id="body">

<h1 style="color:green;">

GeeksForGeeks

</h1>

<p id="GFG_UP"

style="font-size: 17px;

font-weight: bold;">

</p>

<button>

click here

</button>

<p id="GFG_DOWN"

style="color: green;

font-size: 24px;

font-weight: bold;">

</p>

<script>

$('#GFG_UP').text(

"Click on the button to see "+

"whether user's device is iPad or not");

$('button').on('click', function() {

var is_iPad =

navigator.userAgent.match(/iPad/i) != null;

$('#GFG_DOWN').text(is_iPad);

});

</script>

</body>

</html>

Output:

  • Before reaching the bottom:
  • After reaching the bottom:




If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the “Improve Article” button below.

Article Tags :


thumb_up
Be the First to upvote.

Please write to us at [email protected] to report any issue with the above content.


Post navigation


Previous

first_page Generate random alpha-numeric string in JavaScript







Source link

Filed Under: c programming Tagged With: •   Dynamic Programming, About Us, Advanced Data Structure, Advanced Topics, Algo ▼, Algorithm Paradigms ►, Algorithms, All Algorithms, All Data Structures, Analysis of Algorithms, Aptitude, Array, Backtracking, Binary Search Tree, Binary Tree, Bit Algorithms, Branch & Bound, C, Campus Ambassador Program, Campus Geek of the Month, Careers, Company Prep, Company-wise, Competitive Programming, Compiler Design, Computer Graphics, Computer Networks, Computer Organization, Computer Organization & Architecture, Contact Us, contribute.geeksforgeeks.org, Core Subjects ►, Courses, CS Subjects, CS Subjects ▼, CS Subjectwise ►, CSS, Data Structures, DBMS, Design Patterns, Detect a device is iOS or not using JavaScript, Differences between Bootstrap and JQuery UI, Digital Electronics, Divide and Conquer, DS ▼, Engg. Mathematics, Experienced Interviews, Game Theory, GATE ▼, GATE 2019, GATE CS Corner, GATE Notes, GATE Official Papers, GBlog, Geek of the Month, Geek on the Top, Generate random alpha-numeric string in JavaScript, Geometric Algorithms, Graph, Graph Algorithms, Greedy Algorithms, Hashing, Heap, Hire with Us , How to begin?, How to change opacity while scrolling the page?, How to change the background color after clicking the button in JavaScript ?, How to detect a mobile device in jQuery?, How to detect browser or tab closing in JavaScript ?, How to detect escape key press using jQuery?, How to detect touch screen device using JavaScript?, How to detect when user scrolls to the bottom of a div ?, How to get the ID of the clicked button using JavaScript / jQuery ?, How to upload files asynchronously using jQuery?, HTML, HTML & XML, HTML Course - Starting the Project | Creating Directories, HTML Course | Basics of HTML, HTML Course | First Web Page | Printing Hello World, HTML Course | Structure of an HTML Document, https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js, ide.geeksforgeeks.org, Internship, Internship Interviews, Internships, Interview ▼, Interview Experiences, Introduction to HTML CSS | Learn to Design your First Website in Just 1 Week, ISRO CS Exam, Java, JavaScript, jQuery, jQuery | :contains() Selector, jQuery | :first-child Selector, jQuery | :has() Selector with example, jQuery | :input Selector, jQuery | :nth-of-type() Selector, jQuery | :only-of-type Selector, jQuery | [attribute^=value] Selector, jQuery | [attribute] Selector, jQuery | * Selector, jQuery | Add Elements with Examples, jQuery | ajax() Method, jQuery | ajaxSetup() Method, jQuery | Callback Functions, jQuery | Create a div element, jQuery | css(), JQuery | Detect a textbox content is changed or not, jQuery | Get and Set CSS Classes, jQuery | getJSON() Method, jQuery | getScript() Method, JQuery | How to implement Star-Rating system using RateYo, jQuery | jquery Property, jQuery | jQuery.fx.interval Property with example, jQuery | jQuery.fx.off Property, jQuery | jQuery.support Property, jQuery | multiple classes Selector, jQuery | post() Method, jQuery | Set Content and Attributes, jQuery | text() Method, jQuery | Traversing Filtering, jQuery | trigger() Method, jQuery | unbind() Method, jQuery | val() with Examples, jQuery-Misc, Languages, Languages ►, Languages ▼, Last Minute Notes, LinkedList, Machine Learning, Mathematical Algorithms, Matrix, Microprocessor, Multiple Choice Quizzes, Navigator userAgent Property, Opening google search results simultaneously in new tabs in Chrome, Operating Systems, Pattern Searching, PHP, Placement Course, Practice, Practice Company Questions, Privacy Policy, Program Output, Project, Puzzles, Python, Queue, Quizzes ▼, Randomized Algorithms, Reader's View of a GeeksforGeeks webpage, Scala, School Programming, Scroll to the top of the page using JavaScript/jQuery, Searching Algorithms, Skip to content, Software Engineering, Some rights reserved, Sorting Algorithms, SQL, Stack, Strings, Students ▼, Suggest an Article, Testimonials, Theory of Computation, Top Topics, Topic-wise, Topicwise ►, Tree based DS ►, UGC NET CS Paper II, UGC NET CS Paper III, UGC NET Papers, Video Tutorials, Videos, Web Technologies, Web Technology, What’s Difference?, Write an Article, Write Interview Experience

Primary Sidebar

Recent Posts

  • CAT 2019 Preparation Strategy : How to Ace the CAT Exam in 4 Months
  • WWE Network Sees Increase in Subscribers
  • Fermentation Technology Questions and Answers – Health Benefits of Fermented Foods
  • Add the given digit to a number stored in a linked list
  • Internships in Marine Engineering
  • Privacy Policy
  • About
  • Contact US

© 2019 ProProgramming
 Privacy Policy About Contact Us