answerstu

How to define multiple CSS attributes in jQuery?

Is there any syntactical way in jQuery to define multiple CSS attributes without stringing everything out to the right like this:$("#message").css("width", "550px").css("height", "300px").css("font-size", "8pt");If you have, say, 20 of these your code will become hard to read, any solutions?From jQuery API, for example, jQuery understands and returns the correct value for both .css({ "background-color": "#ffe", "border-left": "5px solid #ccc" }) and .css({backgroundColor: "#ffe", borderLeft: "5px solid #ccc" }).Notice that with the DOM notation...Read more

jQuery toggle div and toggle class

I've got a side navigation where a user can click on a link which then toggles a panel with options for that section. My problem with this at the moment is i need to be able to remove the class when a user clicks on the same link to hide the panel.Right now the 'active' state is getting left on the link. It works fine when your clicking from one link to another, but id like it to also remove the 'active' state if someone wishes to hide the menu. The 'active' class is shown with the cyan highlight on the menu.jsFiddle: http://jsfiddle.net/visual...Read more

html - jQuery toggle dropdown not working

I am creating a dropdown list with jQuery and toggle function, as I want the selector to be clickable with dropdown options displayed with a custom scrollbar.Up to now I have some code like this: JSFiddle$(".row-span").click(function(){$("#expandDropDown").toggleClass('drop');$("#quantitySelectDrop").toggleClass('active');$(".mCSB_container").mCustomerScrollbar();$(".active-result").hover(function(){$(this).toggleClass('highlighted').siblings().removeClass('highlighted');})})When the div is clicked, a dropdown menu with various options will be ...Read more

Resize google map in jQuery toggle div - display issue

I have a small div displaying a google map. On click of button i have map div panel expanding bigger - simple jQuery toggle. This works fine but the map is not displaying correctly once toggled to larger size. I'm using google.maps.event.addDomListener(window, 'resize', function()and var currCenter = map.getCenter(); to allow for the container resize and re-centering of map but for some reason it's not working.It's creating the issue of grey blocks and not centering.Here's the google maps code i'm using: function initMap() { var mapDi...Read more

jquery - Show/Hide content inside ul li

I want to show/hide content inside li by clicking on a link, just like the 'more information' button. The code I have hides the content of every li, not just the clicked one. Please take a look: $(document).ready(function() { $('ul li').on('click', '.abrir', function(e) { e.preventDefault(); $('ul li').find('.oculto').toggle(); });});<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><ul> <li> Biológica <span class="abrir">>></span> <span class="...Read more

Simple jQuery toggle() won't work

jQuery is linked, no spelling misteakes, syntax is correct? I bet it's something really stupid but I'm going crazy here. Any ideas?jQuery:$(document).ready(function(){ $("#toggle-1").click(function(){ $("#box-info-1").toggle(); });});html:<div id="section-1"> <p class="map-toggle" id="toggle-1">1</p> <div id="box-info-1"> <div class="arrow-up"></div> <div class="info" id="info-1"></div> </div> </div>CSS:#section-1 {position: absolute;display: inline-block;m...Read more

jquery - Draw huge svg from an array and scale it within the parent element

I have grabbed the svg file (the map of Russia) and have got the array of paths. Here is the snippet:var states = [ { id: "1", d: [ "m 6477.42,3306.03 -13.31,-25.82 -71.82,-40.46 -52.18,49.61 -52.21,5.21 -74.43,-48.3 -50.89,-62.66 -18.29,-63.95 -33.92,-10.44 -41.79,20.88 -40.45,-3.91 -20.89,-27.42 -18.28,15.67 -16.97,-18.29 -20.86,19.59 29.99,30.02 -70.47,5.23 -40.47,-35.25 22.19,-75.71 -40.47,-39.15 v 58.73 h -27.41 l -27.41,-24.8 -6.52,30.03 40.47,36.55 -43.09,-2.62 -127.92,-65.26 24.8,-30.02 -36.54,-35.25 14.35,-2...Read more

jquery - way for div with border radius to have text not go ouside circle

I have no idea if this is possible, maybe there's a way to do this with just CSS or maybe jquery or jquery plugin. When you put a border radius on div for example, and then you put text in that div, the text is contained by the div's original square shape, and overflows the circle created by the border radius. Is there some way to have the circle shape do the text containing?Thanks in advance for any help....Read more

jquery - Checkbox/Radio how to color buttons

I have a working Checkboxradio, but I would like to change both the active and inactive color of the buttons. I've gone down several jQuery UI documentation paths that looked like they would work, but I can't seem to get everything in alignment to accomplish this. Below is HTML from my page:<fieldset> <label for="checkbox-1">Hot</label> <input type="checkbox" name="checkbox-1" id="checkbox-1"> <label for="checkbox-2">Humid</label> <input type="checkbox" name="checkbox-2" id="checkbox-2"><...Read more

jquery - Is there any way to force an ag-grid row to show even though it doesn't meet the Quick Filter criteria?

I have two ag-grids that I am moving items between; one is a searchable list of available items, and the other is a list of the items that the user has previously chosen to add. Users can add items to the below grid by selecting them from the top grid and clicking "add." They can remove items from the bottom grid by selecting them in the below grid and clicking "remove." Above the top ag-grid, I have a search box that is set as a Quick Filter for that grid.When a user removes an item from the bottom grid, I want it to show in the top grid, rega...Read more

Use ASP.NET MVC validation with jquery ajax?

I have simple ASP.NET MVC action like this : public ActionResult Edit(EditPostViewModel data){}The EditPostViewModel have validation attributes like this : [Display(Name = "...", Description = "...")][StringLength(100, MinimumLength = 3, ErrorMessage = "...")][Required()]public string Title { get; set; }In the view I am using the following helpers : @Html.LabelFor(Model => Model.EditPostViewModel.Title, true) @Html.TextBoxFor(Model => Model.EditPostViewModel.Title, new { @class = "tb1", @Style = "width:400px;" })I...Read more

jquery - TableSorter Filtering Multiple Child Rows and TBody

ScenarioUsing TableSorter (FORK) 2.18.3jQuery 2.1.1I have used a combination of denoting rows as "tablesorter-childRow" and defining tbody elements as "tablesorter-no-sort" entries. This combination allows me to sort the child data detail rows by the headers. And maintain them under the corresponding "Title" row.I am encountering two issues:Issue 1: If I define the detail data rows as children of the parent "title" row (which is what I want). The detail data rows cease being sortable. Is there a way to define rows as being child without losing...Read more

jquery - button click should display data in <div> using cellRenderer in ag-grid

I have ag-grid table. I am replacing 'Bookingxml' column data with button. When that button is clicked, it should show the data of that particular cell in 'out' div. I went through the documentation and figured, cellRenderer is the way to do it. I tried below code, but that didn't work. var gridOptions = { columnDefs: [ {headerName: 'Booking Type', field: 'BookingType', width: 200}, {headerName: 'Booking Error', field: 'BookingError', width: 150 }, {headerName: 'Booking Date', field: 'BookingDate', width: 150, filter: 'n...Read more