spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Getting Child ul in an li


The problem is parent_id is the anchor element which does not have the class .sub-cat-list1.

You can target the next sibling of the clicked anchor element like

$("a.parent-cat").click(function () {
    var $this = $(this);
    var prent_id = this.id;

    $.getJSON('/Products/GetChildCategories/' +
prent_id, function (data) {
        $.each(data, function (i, item) {
            var sub_cat_li = "<li><a
href='#' id=" +
JSON.stringify(item.Item1).replace(/"/g, "") +
">" + JSON.stringify(item.Item2).replace(/"/g,
"") + "</li>";
           
$this.next('.sub-cat-list1').append(sub_cat_li);
// this is not appending.            
        });

    });

});

Or use the adjacent sibling selector

$('#' + prent_id + ' +
.sub-cat-list1').append(sub_cat_li); 

Categories : Javascript

Related to : Getting Child ul in an li
Parent, Child, Child of Child in Laravel
This is because cities is a Collection you have to loop through each of them to get the jobs number and add them up. Within controller: Like so; $job_count = 0; $province->cities->each(function ($city) use ($job_count){ $job_count += $city->jobs->count(); }); The $job_count would be equal to the total number of jobs within each of it cities. Please Note: Be sure to eager lo

Categories : Laravel
rename and send all child nodes based on value of element in child node in xslt
You first need to start off with the XSLT identity template, which on its own copies all the nodes in the XML as-is <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> This means you only need to write templates for the nodes you wish to transform. You want to change Report_ID elements into R

Categories : Xml
Retrieve Parent Child Cub-Child recors in SQL Query
Add Recursion column to CTE2 and in the final select statement should look like: SELECT ID, case when Recursion = 1 then Name else replicate(' ', Recursion) + Name end as Name, ParentID, Path FROM CTE2 WHERE RowNumber = 1; http://sqlfiddle.com/#!3/07faa/28 Note: if you run the code in SQL Server management studio then the spaces will be seen (in SQL Fiddle there may be

Categories : SQL
CSS: Child of a child
This format is on dozens of pages that will need to have a link to a CSS file to override the defaults. Just a guess, but you might just need to use !important, even though it's not the best form. The CSS hierarchy is inline, tag selector (td, span, etc.) ID, class. So what you're using to override is at the bottom of the food chain. Using !important would bring it up to the very top, assumin

Categories : HTML
Targeting 2nd ul and 5th child
You can find the 2nd ul using: $("ul")[1] Then, to find the 5th li, you can use the jQuery find() method along with :eq But to use them you have to convert it back to a jQuery object. So, finally you end up with something like: $($("ul")[1]).find("li:eq(4)").after('<li>New Item</li>');

Categories : Jquery
Recently Add
Busy Indicator while page is loading
parent.document.getElementById and images path
Can not get bootstrap datetime picker to display properly
reading select box jquery issues
DC.JS Pie Chart + Select Deslect from external JavaScript function
Why would I ever need to cancelAnimationFrame()
Angular.ui alert doesn't close
HTML/JS How to position a rectangle relative to 'any' side of the parent canvas element
parse variable to xml
C# Dictionary equivalent in JavaScript
ExtJS Dashboard Panel Fit Panel Vertically
jQuery cross domain ajax call - Interpreted as script but transferred with MIME type text/xml
Reactjs map returns unexpected token }
Working with multiple pages in apache cordova and vs2013
Resize iframe to loaded content
Why 13596*0.1 is different than 13596/10?
AngularJS Validate all forms on application load
javascript open popup without menu/url/titlebar/scrollbar/anything
Can I use Razor syntax inside Javascript included in a ScriptBundle?
How to show a box for comment reply with id
parse name from user input when using jquery serialize
How to parse and load javascript object?
Marionette not navigating to the same url
Adding Google+ Sign in button to website
GRUNT - Install Grunt Packages?
how should I create the path of templateUrl property in Angular ui-router?
Update mysql database with jquery array using ajax
Run the same function on each item in a list / array
Get all ticks values (NVD3)
Button Click Event not Passing input String to MVC Controller Method
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.