Skip to content
Advertisement

Tag: jquery

How to get the tag HTML with JavaScript / jQuery?

Using $(‘html’).html() I can get the HTML within the <html> tag (<head>, <body>, etc.). But how can I get the actual HTML of the <html> tag (with attributes)? Alternatively, is it possible to get the entire HTML of the page (including doctype, <html>, etc.) with jQuery (or plain old JavaScript)? Answer The simplest way to get the html element natively

Javascript Optimization, where to begin?

I’ve started work recently at a new company and they have an existing application with 1000s of lines of Javascript code. The baseline contains dozens of JS files with easily over 10,000 custom lines of code, they also use multiple 3rd party libraries such as Jquery, Livequery, JQTransform and others. One of the major complaints they have been receiving from

How to jump to top of browser page

I’m writing a modal popup and I need the browser to jump to the top of the screen when the open modal button is pressed. Is there a way to scroll the browser to the top using jQuery? Answer You can set the scrollTop, like this: Or if you want a little animation instead of a snap to the top:

HTML5 Video Dimensions

I’m trying to get the dimensions of a video of which I’m overlaying onto a page with JavaScript, however it is returning the dimensions of the poster image instead of the actual video as it seems it’s being calculated before the video is loaded. Answer Spec: https://html.spec.whatwg.org/multipage/embedded-content.html#the-video-element

Checking if a URL is broken in Javascript

This question has been posted on Stack before, but none so specific as to what I’m trying to understand. The simplest way to check if a URL is corrrect to send a http Head request. But how do you use that to specify the URL ? I found this in a previous post : But it doesn’t seem to run

Advertisement