How do I set/unset a cookie with jQuery?
How do I set and unset a cookie using jQuery, for example create a cookie named test and set the value to 1? 1 17
How do I set and unset a cookie using jQuery, for example create a cookie named test and set the value to 1? 1 17
I’m refactoring some old JavaScript code and there’s a lot of DOM manipulation going on. var d = document; var odv = d.createElement(“div”); odv.style.display = “none”; this.OuterDiv = odv; var t = d.createElement(“table”); t.cellSpacing = 0; t.className = “text”; odv.appendChild(t); I would like to know if there is a better way to do this using … Read more
I have a table column I’m trying to expand and hide. jQuery seems to hide the <td> elements when I select it by class but not by the element’s name. For example: $(“.bold”).hide(); // Selecting by class works. $(“tcol1”).hide(); // Selecting by name does not work. Note the HTML below. The second column has the … Read more
I would like to find out, in JavaScript, which element currently has focus. I’ve been looking through the DOM and haven’t found what I need, yet. Is there a way to do this, and how? The reason I was looking for this: I’m trying to make keys like the arrows and enter navigate through a … Read more
I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript. 2 29 The correct approach is to use element.getBoundingClientRect(): var rect = element.getBoundingClientRect(); console.log(rect.top, rect.right, rect.bottom, rect.left); Internet Explorer has supported this since as long as you are likely to care about and … Read more
So jQuery 1.6 has the new function prop(). $(selector).click(function(){ //instead of: this.getAttribute(‘style’); //do i use: $(this).prop(‘style’); //or: $(this).attr(‘style’); }) or in this case do they do the same thing? And if I do have to switch to using prop(), all the old attr() calls will break if i switch to 1.6? UPDATE selector=”#id” $(selector).click(function() { … Read more
How can I get the selected text (not the selected value) from a drop-down list in jQuery? 3 35
How can I change the class of an HTML element in response to an onclick or any other events using JavaScript? 3 34
Is it possible to toggle the visibility of an element, using the functions .hide(), .show() or .toggle()? How would you test if an element is visible or hidden? 6 63