Skip to content

Tag: jquery

Javascript find if english alphabets only

Am trying to find some text only if it contains english letters and numbers using Javascript/jQuery. Am wondering what is the most efficient way to do this? Since there could be thousands of words, it should be as fast as possible and I don’t want to use regex. Thank you for your time. Answer A regular …

jQuery’s offset() function

I know jQuery does most when it comes to cross-browser issues. I just wanted to know if offset() method of jQuery serves the purpose of cross-browser compatibility, I mean top, left, etc properties that can be derived from it? Basically once I apply top, left, etc properties (which are derived from offset() f…

jQuery vs. javascript? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 9 years ago. Improve this question I recently stumbled upon some javascript forums (sadly, link is lost …

Best way to add DOM elements with jQuery

So I’ve seen three ways to add html/DOM elements to a page. I’m curious what the pros and cons are for each of them. 1 – Traditional JavaScript I believe the straight JS way to do it is by constructing each element, setting attributes, and then appending them. Example: 2 – Appending a …

Non-AJAX jQuery POST request

I am trying to use the jQuery POST function but it is handling the request in AJAX style. I mean it’s not actually going to the page I am telling it to go. This function should go to comments.php page with the aid value in hand. It’s posting fine but not redirecting to comments.php. @Doug Neiner C…

How to get the number of lines in a textarea?

What I would like is to count the number of lines in a textarea, e.g: should count up to 4 lines. Basically pressing enter once would transfer you to the next line The following code isn’t working: It always gives ‘1’ no matter how many lines. Answer I have implemented the lines and lineCoun…