Skip to content
Advertisement

Tag: jquery

How to wait for div to load before calling another function?

I’m loading subpages to a selected div of my main page by a jQuery function. In order to synchronise main div’s and right column’s height I’m using jQuery’s .css() method. I wanted that resizing to look smoothly, so I’ve resolved it to following steps: 1. Load content of a subpage to an invisible temp div. 2. Calculate the height of

OnClick Send To Ajax

I’m trying to complete some ajax requests to insert a textarea into a database without refresh. Here is my code: HTML: JS: My Questions: 1) How do I send the contents of the text area into the onclick function? 2) How do I escape/urlencode etc.. So it retains line breaks Answer You have few problems with your code like using

jQuery target window and a scrollable div?

I’m trying to target the scroll event for both the window and scrollable divs. Is there a way to do this in one statement? I’ve tried… Only way I have found is calling them both separately… Answer There may be a better way to do this, but you could use $.map to create a jquery object with both window and

Jquery form submission not being triggered

I’m new to JavaScript. I have been trying to design some code which geocodes a location when a search button is hit and the submits the form if successful. To make it to slightly more complicated, if an option from the autosuggest is selected, it also geocodes it even before the search button is hit. This all seems to work,

OnClick thumbnails – load image

I have a simple image gallery of about 25-30 photos with a thumbnails strip What i want is to load only the image that i click the thumbnail for not to wait until all the 25-30 photos are loaded because it slows down my website. Any ideas how to do that? Answer First, put all 25-30 photos on the page

No events for dynamically generated input tags

I have dynamically generated some input tags for a web application. The appended elements do not seem to have associated click, select etc.. events. I read you can you .on(). I would like to associate all possible events to all types of elements in a general way. What is the best way to go about this? Answer Suppose you want

Add class to li if content is a certain string

Would it be possible to add a certain class to a li that contains a certain string of text using JavaScript/jQuery? UPDATE/NEW QUESTION: Instead of detecting the content of the li, can I have it add the class if the li has another specified class? Answer Answering the fellow’s extended question: You’re asking really basic questions. I’d recommend you just

Advertisement