JavaScript - jQuery - Ajax

Topics related to client-side programming language.
Post questions and answers about JavaScript, Ajax, or jQuery codes and scripts.

  1. » MarPlo
    I have two DIVs that I need to know the calculated browser distance (in width and height) of them.
    Example html:
    <div id="dv1">div...
    Last post » Admin
    Use the offset() function.
    Something like this should work:
    <div id="dv1">div 1</div>
    Some text ...<br>...


  2. » MarPlo
    I have an array of integers:
    var array = [2, 5, 9, 8];
    Is there a simple way to remove a specific element from an array? The equivalent of...
    Last post » Admin
    Use the indexOf() to find the index of the element you want to remove, then apply splice() to remove it:
    var array = [2, 5, 9, 8];
    var index...


  3. » Marius
    I am using a jQuery script that adds dynamically a Div in the DOM. I am trying to ad onclick event for this div.
    HTML:
    <div...
    Last post » Admin
    The live() method for registering events in jQuery is deprecated. Use instead the on() method.
    This is called event "delegation"....


  4. » Marius
    Hi there,
    I would like a little advice for a proper way to animate with JavaScript, without using jQuery or other framework, just with pure...
    Last post » Admin
    Hello,
    The JavaScript has a function for animating objects, called requestAnimationFrame() that works in modern browsers (IE 10+)....


  5. » Marius
    Hi,
    Does anyone know how to add option in web page to change the css theme?
    For example, i have two css files: "light.css", and...
    Last post » Admin
    Welcome
    It can be made with html and javascript:
    - Add an id to the html <link> tag which loads the css file.
    - Create a <select>...


  6. » Marius
    How to focus on particular part of a web page by using javascript events?
    Let's say I clicked a button and it will scroll down or scroll up to a...
    Last post » MarPlo
    Hi,
    To scroll to a specified element, use the element.scrollIntoView() method (this method scrolls the current element into the visible area of the...


  7. » Marius
    How can I dynamically set /modify the values of certain form elements, more specifically certain input text fields? So far, whenever I load my html...
    Last post » MarPlo
    Hi,
    Add an ID to the input text field, for example:
    <form id="form1">
    <input type="text" name="q01"...


  8. » mowgli
    I see this is a very young forum, I came here looking solutions about Fotorama, anyway I had more answers here in few days that on the big...
    Last post » Admin
    Hi,
    That code not works because you have the thumbs in <img> tag, but in jQuery you refer to "a" ( $('.my-thumbnails a') ).
    Try...


  9. » mowgli
    I really like and use Fotorama. In this site is posted a full and very good explanation of it. Thanks to the author! I downloaded and wanted to use...
    Last post » mowgli
    Wow, you're full right! After working on it for 6 hours I found the same solution and I came here to write it. Maybe if I came here before, I'd see...


  10. » Marius
    Hi,
    How can i st into a variable, for example an Array with two elements, the ID of the first and the last clicked Div which is into a parent DIV....
    Last post » Admin
    Hi,
    I think you can use this code.
    <div id="parent">
    <div id="id1">
    <div id="id2">
    <div...


  11. » Marius
    Hi,
    How can I set a variable with the id of the last hovered DIV or SPAN in page, using JavaScript /jQuery?
    I tryed with "onmouseover"...
    Last post » Admin
    Hi,
    Try this code.
    - Simple JavaScript:
    <div id="content">
    <span>
    <div id="id1">
    <span...


  12. » Marius
    Hi,
    I have a html table with data from mysql database.
    To each row in the html table there is an edit button. When i click on the edit button, I want...
    Last post » Admin
    Hi,
    Here is a simple and easy example:
    Just study the javascript code, and adapt it to your html table.


  13. » Marius
    I have a tabs effect on a web page and when the page is refreshed it loses the last active tab and goes back to the first tab.
    How to make so after...
    Last post » Admin
    Hi,
    You can use the sessionStorage JavaScript object to store data in the browser session, that can be used after page refresh.
    You can add data in...


  14. » Marius
    Hi,
    I have a function sendAjax() which makes an Ajax request (with jQuery). How can I return the response from sendAjax()?
    I tried to return the...
    Last post » MarPlo
    Hi,
    I usually use a callback function that is passed as argument to the Ajax function.
    The callback function is accessed when success, receives the...


  15. » Marius
    Hi,
    I have a Div with some content and other html tags inside.
    How can I get all the text content of this Div, without the html tags?
    I ussed...
    Last post » Admin
    You can use this:
    <div id="d_id">
    Some content ...
    <p>Other html element.</p>
    <span>Text in...


  16. » Marius
    Hi,
    I have this HTML table. How can I get the TD data from each row in JavaScript (in JSON format) to be passed via Ajax to a PHP script?
    <table...
    Last post » Admin
    Hi
    Here is a JavaScript function that returns a 2-dimensional array with the <td> data of each row.
    Then, use JSON.stringify(array) to convert...


  17. » Marius
    Hi
    How can I move the window scrollbar vertical position up or down by a specified number of pixels?
    I'm using this function to get the scrollbar...
    Last post » MarPlo
    Hi
    There are various ways to set tthe scrollbar position. For example, you can use the scrollTo(x, y) function, or scrollTop property for vertical...


  18. » Marius
    Hi
    I am trying to drag a table row and to drop it in a similar table (of same table structure).
    I am trying to implement with jQuery UI draggable....
    Last post » MarPlo
    Hi,
    Check the code example from this page: jQuery Drag and Drop Rows between two similar Tables


  19. » Marius
    Hi,
    How to upload a file and display a progress bar, percentages "%" of the upload progress, without refreshing the page? I think it is...
    Last post » MarPlo
    Hi
    Try this script. It uses jQuery and form plugin; also, it checks the file type before upload.
    To auto submit the file, without to click the submit...