[Solved] Referring to the triggering object in the done() block of a post() call?

You can use the var that = this workaround or just use ES5 .bind function to set the this correctly! jQuery(‘.vote .magic_button’).click(function() { jQuery.post(url, { action: ‘ajax_vote’, ‘vote_target’: jQuery(this).data(‘postid’) }) .done(function(data) { // $img = jQuery(this).find(‘img’); }.bind(this)) }); Documentation 5 solved Referring to the triggering object in the done() block of a post() call?

[Solved] $(document).on doesn’t work

I don’t think there’s ever been a version of jQuery that supported what you’re doing in the new code. Your code is calling cache, then bindEvents. You have this in cache: this.postForm = $(‘#postForm’); and this in bindEvents: $(document).on(‘submit’, this.postForm, this.createPost); So that means you’re calling on and passing it an event name, a jQuery … Read more

[Solved] How can I apply a style to a parent of a specific child

I think what you need is $(‘ul.navbar-nav li’).hover(function () { $(this).find(‘.sidenav_wrapper:first’).css(‘display’, ‘block’); }, function () { $(this).find(‘.sidenav_wrapper:first’).css(‘display’, ‘none’); }); $(“.sidenav_active”).parent().css({ “display”: “block” }); $(‘.sidenav_active’).closest(‘.sub_menu’).find(‘a’).css({ “font-weight”: “700” }); Demo: Fiddle 0 solved How can I apply a style to a parent of a specific child

[Solved] sum numeric values in a multidimentional array

Just: var scores = [{ “firstName”: “John”, “value”: 89 }, { “firstName”: “Peter”, “value”: 151 }, { “firstName”: “Anna”, “value”: 200 }, { “firstName”: “Peter”, “value”: 22 }, { “firstName”: “Anna”, “value”: 60 }]; var names = {}; var new_arr = []; scores.forEach(function(entry) { if (names.hasOwnProperty(entry.firstName)) { new_arr[names[entry.firstName]].value += entry.value; } else { names[entry.firstName] = … Read more

[Solved] How to get control values and modify them in Page Methods?

Quick example: <asp:ScriptManager runat=”server” EnablePageMethods=”true” /> <!– or ToolkitScriptManager, but remember to put only one –> <script type=”text/javascript”> function invokeMethod() { x = document.getElementById(‘<%= TextBox1.ClientID %>’).value; PageMethods.theMethod(x, OnSuccess, OnFailure); } function OnSuccess(r) { document.getElementById(‘<%= TextBox1.ClientID %>’).value = r; } function OnFailure(r) { alert(r._message); } </script> [System.Web.Services.WebMethod()] public static string theMethod(string x) { return x + … Read more

[Solved] I desperately need somebody to help me make my CSS slider autoplay

Since you have no markup to offer, I’ve created this: Example snippet (pure css): body { background: #eee; font-family: arial, helvetica, sans-serif; margin: 50px auto; padding: 0; } h1 { font-family: ‘Proxima Nova’, ‘Helvetica Neue’, sans-serif; font-size: 36px; text-align: center; } h3 { font-family: ‘Proxima Nova’, ‘Helvetica Neue’, sans-serif; font-size: 22px; font-style: italic; color: #4e4e4e; … Read more

[Solved] How to create dynamic nested divs within ul li tag using jquery

First, give the ui a id, i choose rootEl <ui id=”rootEl”> </ui> Second, this JavaScript: var rootEl = document.getElementById(‘rootEl’); function appendStuff() { var listItem = document.createElement(‘li’); var videoThumbnail = document.createElement(‘div’); var myImage = document.createElement(‘img’); var videoDesc = document.createElement(‘div’); var videoDate = document.createElement(‘div’); videoThumbnail.setAttribute(‘class’,’videoThumbnail’); myImage.src = “https://stackoverflow.com/questions/28105063/./img6.jpg”; videoDesc.setAttribute(‘class’,’videoDesc’); videoDate.setAttribute(‘class’,’videoDate’); videoDesc.innerHTML = “Lorem ipsum dolor sit amet”; … Read more

[Solved] How do I move a div in the html? [closed]

This must work : $(“#two”).appendTo(“.wrapper”); This must also work : $(“.wrapper”).append($(“#two”)); append and appendTo are considered moving functions in jQuery. You must look at the docs more. Demo : http://jsfiddle.net/hungerpain/gjJJe/ 1 solved How do I move a div in the html? [closed]

[Solved] Store First & Second Character value in two different veritable [closed]

Using plain javascript, you can use the “substring” method of a string object to retrieve specific characters. Please see MDN String::substring var main = document.getElementById(“ccMain”); var text = main.innerText; console.log(“First Letter: ” + text.substring(0,1)); console.log(“Second Letter: ” + text.substring(1,2)); <div id=”ccMain”>Simple Text</div> solved Store First & Second Character value in two different veritable [closed]

[Solved] Need help in changing the dropdowns into range slider. Any help would be appreciated [closed]

Consider the following. $(function() { $(“.slider”).change(function() { var v = $(this).val(); $(this).next(“.value”).html(v + “000000”); if ($(this).is(“#priceFrom”)) { $(“#priceTo”).attr(“min”, v).val(v).trigger(“change”); } }); }); .form-group label { width: 60px; } <link rel=”stylesheet” href=”https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css” integrity=”sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh” crossorigin=”anonymous”> <script src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <div class=”form-group”> <label>FROM</label> <input type=”range” min=”2″ max=”9″ value=”2″ class=”slider” id=”priceFrom” /> <span class=”value”>2000000<span> </div> <div class=”form-group”> <label>TO</label> <input type=”range” min=”2″ … Read more

[Solved] Funnel chart with bars [closed]

Use clipping with polygon. My polygons go from upper left, to upper right, to lower right, to lower left. I used the css calc function in order to make the offset relative to the end. I did a 40px slant, but if you want more a slant, simply change that number. body { background:black; } … Read more