JavaScript - jQuery - Ajax


  1. » PloMar
    I have an object like this in javascript:
    var obj = {
    prop1: 'val 1',
    prop2: 'val 2',
    prop3: 'val 3'
    };
    What is the best way to retrieve a list...
    Last post » Admin
    You can use the built in Object.keys method:
    var obj = {
    prop1: 'val 1',
    prop2: 'val 2',
    prop3: 'val 3'
    };

    var props = Object.keys(obj);...


  2. » PloMar
    I have an object like this in javascript:
    var obj = {
    prop1: 'val 1',
    prop2: 'val 2',
    prop3: 'val 3'
    };
    What is the best way to remove the...
    Last post » Admin
    To remove a property from a javascript object, you can use the delete instruction.
    Example:
    var obj = {
    prop1: 'val 1',
    prop2: 'val 2',
    prop3:...


  3. » MarPlo
    I have a html table and a button, like this:
    <table id= tb_id border= 1 >
    <tr>
    <th>Website</th>...
    Last post » Admin
    To append a row in a html table, use this syntax:
    $('#table_id > tbody:last').append('<tr>...</tr>');
    And to hide the pressed...


  4. » MarPlo
    I'm trying to dynamically add and remove items with jQuery when I press the Append /Remove buttons.
    This is the html code:
    <ul id= lists >...
    Last post » Admin
    Use the append() and remove() jquery methods, like in this example:
    <ul id= lists >
    <li>List Item 0</li>
    </ul>
    <button...


  5. » MarPlo
    I need to serialize an object to JSON in JavaScript. Is there a standard way to do this?
    I have an array defined something like this:
    var countries...
    Last post » Admin
    Use the JSON object methods.
    - To convert an object to a string, use JSON.stringify() :
    var json_string = JSON.stringify(your_object, null, 2);
    -...


  6. » MarPlo
    I want to do something like this:
    $( .chkox ).checked(true);
    Or:
    $( .chkox ).selected(false);
    I wish to set the checked value to check or uncheck...
    Last post » Admin
    Use the prop() method.
    $('.chkbox').prop('checked', true); // checking
    $('.chkox').prop('checked', false); // unchecking
    And if you want to check...


  7. » MarPlo
    Is it posible to run a php function through a javascript function?
    Something like this:
    <div id= php_code >Here will be added the Php Code...
    Last post » Admin
    PHP is evaluated at the server; javascript is evaluated at the client-side/browser, thus you can't call a PHP function from javascript directly. But...


  8. » MarPlo
    Is there any way I can modify the URL of the current page without reloading the page?
    I only need to change the portion after the domain, when a...
    Last post » Admin
    You can use the history.pushState() method to change the url address without refreshing the page.
    It works in modern browsers which suport HTML5....


  9. » MarPlo
    I have written a code that adds a text in canvas on clicking a button.
    And i want to display this text for lets say 2 seconds. How can I make the...
    Last post » Admin
    You have to use setTimeout() to call a function, after a given time, that clears the canvas content.
    Here's a simple demo for writing and clearing...


  10. » MarPlo
    Hi all,
    How can I set the canvas dimensions (width and height) according to window's size, using JavaScript?
    And, if it's possible, to change...
    Last post » Admin
    With self.innerWidth and self.innerHeight you can get the window's width and height. Then, with resize event you can detect when the window is...


  11. » 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>

    <div id= dv2 >div...


  12. » 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 class= ui23...
    Last post » Admin
    The live() method for registering events in jQuery is deprecated. Use instead the on() method.
    This is called event delegation ....


  13. » 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+)....


  14. » 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 dark.css . I want to...
    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> with...


  15. » 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...


  16. » 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 id= id_i1 maxlength= 1 />...


  17. » 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 change with:...


  18. » 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...


  19. » 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 id= id3 >
    <div id= id4...


  20. » 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 event, but I...
    Last post » Admin
    Hi,
    Try this code.
    - Simple JavaScript:
    <div id= content >
    <span>
    <div id= id1 >
    <span id= id2 >
    <div id= id3...


  21. » 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...
    Last post » Admin
    Hi,
    Here is a simple and easy example:
    Just study the javascript code, and adapt it to your html table.


  22. » 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...


  23. » 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...


  24. » 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 Another html...


  25. » 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...

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum