You are doing asynchronous calls in find but in your callback you have other statement after find. These will be executed before find finishes. Could that be the problem?
You can use the jQuery when function (https://api.jquery.com/jquery.when/) to wait for all three promises to resolve. You only need to make sure you also return the promise in your nb1, nb2, nb3 functions. function nb1() { return $.post("p1.php", { action: 1 }, function(data) { console.log(data); }, "json") .fail(function(data) { console.log("error");...
javascript,jquery,html,function
You need to put all the calculations into the calc() function: function calc() { // Get Years var years = (document.getElementById('years').value); // Variables var years; var gallons = 1100 * 365; var grain = 45 * 365; var forest = 30 * 365; var co2 = 20 * 365; var...
Use CSS instead of Javascript. Anyway, you're adding a class to all buttons. Use following code: .submitButton { margin: 0 10px; } ...
Here is one solution that uses alpha gradients, not white gradient. The idea is to mask a gradient with an image. Tested with Chrome 43 on Win. Other browers might require SVG fallbacks. caniuse css-masks? header { font-size: 2em; position: relative; top: 2em; background-color: red; } img { width: 100%;...
Since you are adding checkbox dynamically to the table you can attach clickevent to it as below: While you prepend add one more property called class to checkbox $(".sth:nth-child(5)").prepend('<input type="checkbox" class="chkadd" name="mailcheck" id="cbe">'); Adding change event to dynamically added checkbox $(document).on('change','.chkadd',function(){ //do required stuffs here }); instead of $(document) you...
javascript,jquery,html,jquery-mobile,iframe
$(#framecontent).attr("src", postObj.url); needs to be $('#framecontent').attr("src", postObj.url); If you don't understand why, go check http://www.w3schools.com/jquery/jquery_selectors.asp It can be an other thing too, but without a complete code it's hard to figure what....
You can use a callback as the property value which can return the actual style value $('a').css({ 'left': function () { return -$(this).width() / 2 } }) ...
javascript,jquery,html,html5,forms
Keep both the forms hidden at first and give a ID to each <a> and also to the <form> Then $("#id-of-btn1").click(function(){ $("#form-1").toggle(); }); and $("#id-of-btn2").click(function(){ $("#form-2").toggle(); }); EDIT: This could be a solution to make it completely independent of ID/Classes. If you give a class to div containing all the...
Your problem has nothing to do with jQuery and the form. It is just highly recommended to prevent SQL injection, an attack in which an attacker injects SQL commands into your DB Query by posting it in your form. That's why any data that comes from an untrusted source (eg...
add a blackslash \ at the end of each lines. Multiples lines string can't be parsed without it in js EDIT : with example $('#item').append("<div class='form-group'><label class='col-sm-4 '>Period</label><div class='col-sm-8'><div class='checkbox'><label><input type='checkbox' value='YES' name='currently_attending'>I`m currently attending this course</label></div><div class='row'><div class='col-xs-3'> Month<select class='span2 form-control' required...
javascript,jquery,twitter-bootstrap
You need to call the bootstrapSwitch() again after adding and with a new ID, class or else it will alter the states of existing toggle as well. $('.btn').on('click', function () { $('p').after( '<input id="newCheckBox" type="checkbox" data-off-text="Male" data-on-text="Female" checked="false" class="newBSswitch">' ); $('.newBSswitch').bootstrapSwitch('state', true); // Add }); JSfiddle...
I guess OP wants to link the button more with corresponding click span class $('.clickme').click(function(){ $(this).parent().prev().find(".click").toggle(); }); FIDDLE DEMO...
jquery,twitter-bootstrap,knockout.js,twitter-bootstrap-3
I suggest using a totally different pattern for this. Use one Bootstrap modal at the level of your $root view model. This modal shows data for a root view model observable currentModalItem and is hidden when that observable is null. The modal is activated by setting that observable from inside...
Here is an example : http://jsfiddle.net/xhhLja7m/ $(".choice-option").click(function() { $(this).find('input[type=radio]').prop("checked", "true"); }) ...
jquery,jsp,struts2,struts2-jquery,struts2-jquery-plugin
You should use the value attribute as suggested by @Choatech: value false false String "Preset the value of input element." The value specified, however, should be one of the keys listed in your cityList, not some random value. If the value you want to use is an header one, like...
javascript,php,jquery,ajax,parsley.js
Make sure this line: $('#remarks').parsley( 'addConstraint', { minlength: 5 }); is called before you check isValid()....
javascript,jquery,html,arrays,contains
You can use :contains selector. I think you meant either one of those values, in that case var arr = ['bat', 'ball']; var selectors = arr.map(function(val) { return ':contains(' + val + ')' }); var $lis = $('ul li').filter(selectors.join()); $lis.css('color', 'red') <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <ul> <li>cricket bat</li> <li>tennis ball</li> <li>golf ball</li>...
javascript,jquery,xml,jquery-mobile
EMI and CustomerName are elements under json so you can use .find() to find those elements and then text() to get its value. $(data).find("json").each(function (i, item) { var heures = $(item).find("CustomerName").text(); var nbr = $(item).find("EMI").text(); console.log(heures); }); .attr() is used to get the attribute value of an element like in...
You can wrap your string into a jQuery-object and use the .find()-method to select the images inside the message-string: var msg = '<span class="user_message">hiiiiiii<img title=":benztip" src="path../files/stickers/1427956613.gif" /><img src="path../files/stickers/416397278.gif" title=":happy" /></span>'; var $msg = $(msg); $msg.find('img').attr('src', 'path_to_img'); $("#chat_content").append($msg); Demo...
jQuery is not for DateTime manipulation. It's for querying and manipulating DOM objects. For what you need, you can either implement that yourself, or use a specialized third-party library. Moment.js is pretty neat. Examples: moment().subtract(10, 'days').calendar(); // 06/12/2015 moment().subtract(6, 'days').calendar(); // Last Tuesday at 1:51 PM moment().subtract(3, 'days').calendar(); // Last...
javascript,jquery,animation,svg,snap.svg
You have to wrap the call back in an anonymous function to prevent it from firing immediately: var theCallback = function () { theApp.destroyAnElement("#"+ theParentID); }; And then call it as a function: theElement.stop().animate(animationValues, duration, easing, function() { callback(); // <-- notice the parenthesis }); ...
javascript,jquery,ajax,spring-mvc,datatables
DataTables already sends parameters start and length in the request that you can use to calculate page number, see Server-side processing. If you still need to have the URL structure with the page number, you can use the code below: "ajax": { "data": function(){ var info = $('#propertyTable').DataTable().page.info(); $('#propertyTable').DataTable().ajax.url( "${contextPath}/admin/getNextPageData/"+(info.page...
I think the only thing you're maybe not wrapping your head around is the idea of callbacks and asynchronous methods. You're currently running your console.log statements before the replaceWith occurs. The function() { } block (your "callback") passed as the second parameter to $.get doesn't execute until the AJAX call...
javascript,jquery,html,css,scroll
Here you go: http://jsfiddle.net/vtep7Lf1/ $("document").ready(function() { $("#ccwindow").animate({ scrollTop: $("#ccwindow").height() }, "slow"); return false; }); ...
javascript,jquery,html,json,html5
the first "A" in AJAX stands for "Asynchronous" that means, it is not executed right after it has been called. So you never get the value. Maybe you could first, get the os list and then output what you need, like this: function createCheckBoxPlatform(myDatas) { $.ajax({ url: "/QRCNew/GetOS", type: "post",...
Your assessment is correct. The jQuery object is an array-like object and get is turning the jQuery object into a true array. This is outlined in the documentation. For slice to work on an object other than an array, that object must have property keys that are integers. It must...
I think you have to include it with the ' mark Like this : var userID = '@User.Identity.GetUserId()';...
To bind event for dynamic HTML, You can follow below code : $('containerSelector').on('eventName', 'mainElementSelector' function(e){ }); Realtime example $("ul").on("click", "li:has(:checkbox)", function(){ }); ...
javascript,jquery,html,css,bootstrap
You have some syntax errors otherwise everything is good!! keep url inside quotes as below: $('.jumbotron').css('background-image','url(/path/to/new/image)'); ...
If you know the class, why don’t you just select the element natively using getElementsByClassName? var id = document.getElementsByClassName('HA').item(0).id; Of course, you can also iterate the HTMLCollection if there’s more items (and not null). If you have to assert it’s a div, and if you want to get them all,...
If you want to generalize the action, maybe you can add a class like "list-toggler" to each of your a elements and also a custom data attribute mapping them to a ul, like data-associated-list="#s-lg-link-list-539480". Then you could simplify your JS as something like: $(document).ready(function () { $('.listToggler').bind('click', function() { $($(this).data('associated-list')).slideToggle();...
Use attr() like $(document).ready(function() { $('.project-open').hide(); $('.hackandfly, .scanergy, .connecting-food').click(function() { $slidah = $($(this).attr('class')+'-open'); $slidah.slideToggle(); $('div.project-open').not($slidah).slideUp(); }); }); However, the above will fail if you have multiple classes. A workaround would be to add data-* to the clicked elements like <div class="hackandfly other-class" data-class-target="hackandfly-open"></div> and then $(document).ready(function() { $('.project-open').hide();...
jquery,html,css,drop-down-menu
Firefox has some problems with select-background. You can try this code - it'll remove the arrow, and then you can add a background image with your arrow (I took an icon from google search, just put you icon instead) I get this on FireFox (You can use any arrow icon...
One possible solution is that you move all your clearRect()'s out from the else-statements to the top and clear it from the start. Then you add text in a second step. That way you can also group the if-statements together to form a if-else if relationship (crappy explanation, just look...
You can use 3-Events: - Start (Start-Sliding) -> Stop Player - End (End-Sliding) -> Start Player - Slide (Sliding) -> Move Player-Position $("#range").slider({ range: "min", start: function(event, ui) { player.pauseVideo(); }, stop: function(event, ui) { player.playVideo(); }, slide: function(event, ui) { player.seekTo(ui.value,true); return false; } }); Demo: http://codepen.io/anon/pen/EjwMGV...
As far as I know, Gulp is a helper to manage your project locally, not by connecting to external sources. A common approach would be to manage current library versions by a package manager like Bower – there is an integration bridge available (didn't test it though, I just update...
Try: $.ajax({ url: "functions.php", dataType: "JSON", data: {id: id}, type: 'POST', success: function(json){ for(var i=0;i<json.length;i++){ alert(json[i].fname); } } }); ...
You're using the wrong method to hide the element. Change this: $('#modal-container').modal('hide'); To this: $('#modal-container').hide(); Or if you want to completely remove it from the page, change it to this: $('#modal-container').remove(); ...
You need to add Math.abs and do something like this: var div; var startX = 0 / 1; var startY = 0 / 1; function onMouseMove(e) { div.height(Math.abs(parseInt(e.pageY)-parseInt(div.css("top")))); div.width(Math.abs(parseInt(e.pageX) - parseInt(div.css("left")))); if (parseInt(e.pageY) < startY) { div.css({ "top": e.pageY }); div.height(Math.abs(parseInt(e.pageY)-startY)); } if (parseInt(e.pageX) < startX) { div.css({ "left": e.pageX...
You need to keep the plus before the menu: <a href="#" class="menu-trigger">+</a> <ul class="menu"> <!-- Menu --> </ul> <a href="#" class="menu-trigger">+</a> <ul class="menu"> <!-- Menu --> </ul> And in the jQuery, you need to give only for the plus, you can also make the plus as minus: $(".menu-trigger").click(function () {...
You're trying to output javascript from the php, without outputting it in your ajax callback, won't work. The easiest way to do what you want, is to return the string with your php, and handle the outputting to your javascript. something like : if($QueueCount == 1){ Echo "You already have...
Even though you are using .on() with event delegation syntax, it is not working as the element to which the event is binded is created dynamically. You are registering the handler to col-md-1 which is the parent of the delete button, but that element also is created dynamically so when...
John, Try this: var dataSet = []; for (i = 0; i < mfrPartNumber.length; i++ ) { data = [dateReceived[i],name[i],color[i]]; dataSet.push(data); } This will build an array out of each instance of [i], and keep growing as your user keeps pushing the button....
This statement is wrong: In addition, the default submit action on the form will be fired And when you call event.preventDefault() then the form will not be submitted until you submit the form like below: $('form')[0].submit();//write this code inside your function. ...
Change $('polygon[id^=thisRow]').attr('fill', '#ccc'); to $('polygon[id^=' + thisRow + ']').attr('fill', '#ccc'); Your current line searches for elements whose IDs begin with the string "thisRow". You need to search for IDs beginning with the value of the variable thisRow. Here's an example fiddle with only that line of JS changed (I slightly...
Use the code below instead for column definition. columns: [ { data: "Price", render: function (data, type, row, meta) { if(type === 'display'){ var abbr = row['Currency']; var symbol = ""; if(abbr == "USD"){ symbol = "$"; } else if(abbr == "GBP"){ symbol = "£"; } else if(abbr == "EUR"){...
jquery,html,css,drop-down-menu
I have created a working example for you. You can find the jsfiddle in here This piece of code uses JQuery. (Remember, for these type of tasks, JQuery is your friend =] ). HTML <select id="dropDownMenu"> <option value="option1" selected="selected">yes</option> <option value="option2">no</option> </select> <br> <img id="picture" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f5/House_Sparrow_mar08.jpg/220px-House_Sparrow_mar08.jpg"> Javascript function changeStyle(){...
I modified your code based on your requirement.please check it once. rowCount = $('#table3 tr:last').index() + 1; table4rowCount = $('#table3 tr:last').index() + 1; row = rowCount + 1; var pivot_1 = 1001; var loop = 0 $("#table4 tr:eq(0)").find("th:last").after("<th>Total_col</th>"); for(i=1;i<row; i++) { var d = $('#table3 tr:eq(' + i + ')').find("td:eq(1)").text();...
A jQuery only way would be to iterate over the nth-child(4n) $('.thumbnail:nth-child(4n)').each(function(){ $(this) .prevAll('.thumbnail').andSelf() .wrapAll($('<div/>',{class:"new"})) }); Demo Considering the complexity, not sure whether the prevAll() performs better than the plain for loop. Referring one of my similar answer here...
You're looking for the .blur() event I believe. http://jsfiddle.net/d7mbbmwe/ $('#input1').blur(function() { $('.results').html('') }); ...
javascript,jquery,html,list,loops
You could just check the nesting level by counting parents $("ul li").each(function() { if ( $(this).parents('ul').length < 3 ) { // do stuff } }); FIDDLE To make it more dynamic one could simply find the deepest nesting level and filter based on that var lis = $("ul li"); var...
javascript,jquery,ruby-on-rails
This is a result of Turbolinks. You can get around this with the following: $(document).on 'click', '.my-btn', (event) -> ... This is happening because Turbolinks is loading the page, and there isn't a document ready event being fired. You want to wait until Turbolinks fires the page:load event. You do...
Use onbeforeunload function of javascript window.onbeforeunload = function() { //Declare cookie to close state } This function will be called every time page refreshes Update: To make loop through every value use this $.each this way: var new_value = ""; window.onbeforeunload = function() { $.each($('div.box_container div.box_handle'),function(index,value){ new_value = ($(value).next('.box').css('display') ==...
You may try using :checked var all = $('input[type=radio][name^=game]').length; var chk = $('input[type=radio][name^=game]:checked').length; var exp = all / 2;// in a group two radios each, any one will be selected if(chk === exp) { //all checked } else { // some goup is not checked } $(document).ready(function() { // radio...
I have done a quick hack to solve this. It works well although this may not be the preferred way to do it. Add a hidden input #fullname Populate the hidden input with the value of first and last name separated by a space Validate the signature agianst the hidden...
This line will drill down to the content you want: $(value).attr('data') To put in context of the rest of your script: $j = jQuery.noConflict(); function displaySelected(elem){ var value = $j(elem).find(".columnToHide").html(); console.log($(value).attr('data')); // a05o000000V88VAAAZ } ...
Handlebars does not handle data binding to update on value changes. You may use a framework like ember which comes with two-way data binding. A vanilla way to perform re-rendering upon data change is using Object.observe: Object.observe(someJsonObject, function() { template(someJsonObject); }); ...
If the server has a response header of 'Access-Control-Allow-Origin': '*' or something similar, it will return a response. In short, this has nothing to do with jQuery, and has everything to do with the server. In the case above, * is a wildcard representing all origins. But it could also...
Just got it working: see here. There were two problems here. The first one is that when you add the bgcolorchange class, its background-image wasn't being considered because the first class (metro) already had that property. So, I had to add the !important notation to it, thus being able to...
javascript,php,jquery,html,css3
Ok, so i tried to decypher what you meant with your Question. To Clarify: He has this one page setup. inside the div Our Project, there are two Buttons or links Visit more. When clicked, he wants the About Section to be shown. All in all it is impossible for...
I removed the native JavaScript/jQuery mix and changed the function that checks if a checkbox had been checked: $('#resultTable').on('page.dt', function() { if ($('#r_tab').is(':checked')) { $('.r_tab').show(); console.log('page changed on r'); } else { console.log('page changed on p'); $('.p_tab').show(); } }); ...
Something like this? But adding it into the addUser function as Super Hirnet says, will be more performant. var divs = document.querySelector('#utilizadores').childNodes, users = []; Array.slice.call(divs).forEach(function (node, index) { users.push({ "name" : divs[index].getElementById('nomeUtilizador' + (index + 1)).value }); }); ...
In amcharts the legends are added manually, In your case jut remove the lines which add legends to the chart. For e.g., The legends are added as follows, var legend = new AmCharts.AmLegend(); chart.addLegend(legend); OR AmCharts.makeChart("chartdiv", { "legend": { "useGraphSettings": true }, } Just remove the above lines from your...
jquery,ruby-on-rails,search,if-statement
The standard way to use a search would be to include a parameter in the URL. That way you can have a similar to if user_signed_in? check for the parameter: if params[:search].present?.
I've just updated your jsfiddle: http://jsfiddle.net/0sq2rfcx/8/ This should work on all browsers included IE7 $('#b1').click(function () { $('#result').show(); $("#result").animate({ scrollTop:$('#a1').parent().scrollTop() + $('#a1').offset().top - $('#a1').parent().offset().top}, "slow"); }); $('#b2').click(function () { $('#result').show(); $("#result").animate({ scrollTop:$('#a2').parent().scrollTop() + $('#a2').offset().top - $('#a2').parent().offset().top}, "slow"); }); $('#b3').click(function () { $('#result').show();...
see this example: http://jsfiddle.net/kevalbhatt18/6sjzada9/ Use return false; $('<a class="dz-jcrop" href="http://www.google.com" >google</a>').appendTo('.dz-image-preview'); $(document).on('click', '.dz-jcrop', function(event){ console.log('me'); return false; }); what is different between return and stopPropagation See this link: http://stackoverflow.com/a/30475572/4696809...
jquery,jquery-ui,jquery-mobile
Have you tried using event delegation: http://learn.jquery.com/events/event-delegation/ This lets you put the event on the container and then delegate it to elements within the container whether they exist at design time or not. Change $('.editLink').on('tap', setCurrent); $('.deleteLink').on('tap', function() {... To $(document).on('tap','.editLink', setCurrent); $(document).on('tap','.deleteLink', function() {... ...
javascript,jquery,html,table,drop-down-menu
This is definitely possible, but have you started developing anything? Do you have any code for us to work with? I can point you at a couple good sources to get you started if not. First off, here is how to add a select menu to a column: <th>Date <select...
javascript,jquery,loops,google-chrome-extension,synchronization
One option would be to make your function(response) recursive. When it runs, call this same method again. Pass in some of your "looping" variables, and just do an if check at the beginning. function AnotherGoRound(i,data) { if (i<data[i2].data.length) { console.log("SENDING: i=" + i + "; i2=" + i2); // Send...
javascript,jquery,html,seo,cross-platform
Well the problem is that at first, the section you're about to insert data in is blank, which means that sharing this page on Facebook for example will result in just a blank box. So, what you want to achieve is a way to run that javascript before crawling the...
javascript,jquery,html,css,fancybox
You need to add absolute URL paths in external resources option, not relative. See the Console errors in Firebug. Example: http://fancyapps.com/fancybox/source/jquery.fancybox.js instead of just jquery.fancybox.js Check this: JSFiddle, I forked your JSfiddle and edited the external sources. ...
You are mixing jquery with angular logic with var title = $(this).text(); . You shouldn't try to do this. the $("this") is not referencing what you think it is in that context. You could try logging it to see what I mean. Instead, just pass back the object ng-click="findArticleByTitle(article)" then...
Yes you can write that way. jQuery.noConflict(); jQuery( "body" ).append('Hello'); Read it here...
Consider the HTML block below: <div> <span></span> <span class="block"></span> <span class="block"></span> </div> Then $('.block').first().index(); returns 1 because If no argument is passed to the .index() method, the return value is an integer indicating the position of the first element within the jQuery object relative to its sibling elements. Within the...
The way I think you will have to do it is in each element individually and use this jquery small plugin I rewrite here is the code and also fiddle the html <div id="parent"> thisi sthe fpcd <p>p</p> </div> plugin to find the content of the selector text without child...
javascript,jquery,html,angularjs
You don't really want to handle any DOM stuff in controllers (a controller just ties data to the view, which happens to be the DOM). You want to use a directive for DOM manipulation. (However, yes, ng-click is a built-in directive that can run methods inside the controller). If you'd...
nextAll and first: $(this).nextAll('.hidden').first().slideToggle(...); This question has more about this: Efficient, concise way to find next matching sibling?...
Try this solution: var notrem = []; $('#Table1 tr').each(function(){ var currentRowHTML = $(this).find("td:first").html(); $('#Table2 tr').each(function(i){ var c= $(this).find("td:first").html(); if(c == currentRowHTML ){ notrem.push(i); } }); }); $('#Table2 tr').each(function(i){ if(notrem.indexOf(i) < 0){ $(this).remove(); } }); Explanation: First gather all indexes of Table2 that are equal and are not to be removed....
The problem comes from the difference in relative paths depending on where that path is specified. When specified in a CSS file, the path is relative to that file. When you assign a url() path to an element in JavaScript, it is relative to the page in which the script...
javascript,jquery,ajax,phantomjs,casperjs
I would do something like this in include.js: (function(){ window._allAjaxRequestsHaveStopped = false; var interval; $(document).ajaxStop(function() { if (interval) { clearInterval(interval); interval = null; } interval = setTimeout(function(){ window._allAjaxRequestsHaveStopped = true; }, 500); }); $(document).ajaxStart(function() { if (interval) { clearInterval(interval); interval = null; } }); })(); This sets a (hopefully unique)...
javascript,jquery,html,internet-explorer
Your call of setTimeout fails in any browser, but in IE9 with an exception(what stops the further script-execution). It's a matter of time. At the moment when you call var timer = setTimeout(slideshow, 8000); slideshow is undefined , and undefined is not a valid argument for setTimeout. Wrap the call...
javascript,jquery,css,html5,twitter-bootstrap
Updated. Yes - the first pure CSS solution was not satisfactory. If you dare to add some javascript, you can do this : $('.accordion-group').on('show', function() { $(this).find('.accordion-toggle').removeClass('arrow-down').addClass('arrow-up'); }); $('.accordion-group').on('hide', function() { $(this).find('.accordion-toggle').removeClass('arrow-up').addClass('arrow-down'); }); It is using the bootstrap collapse hide / show events directly on the collapse sections. Still without...
javascript,jquery,json,duplicates
var asset = [ { value1: "1", value2: "2", value3: "3" }, { value1: "1", value2: "5", value3: "7" }, { value1: "6", value2: "9", value3: "5" }, { value1: "6", value2: "9", value3: "5" } ]; function countEqual(oo, pp) { var count = 0; oo.forEach(function (el) { var i,...
First you need to get your timestamps in to Date() objects, which is simple using the constructor. Then you can use the below function to calculate the difference in days: var date1 = new Date(1433097000000); var date2 = new Date(1434479400000); function daydiff(first, second) { return (second - first) / (1000...
I believe that each of the 3 functions bound to the scroll event are getting fired one after the other one, I suggest moving the code to a single one: $(function () { var isGraph1Viewed = false, isGraph2Viewed = false, isGraph3Viewed = false; $(window).scroll(function () { if (isScrolledIntoView($('#myStathalf1')) && isGraph1Viewed...
The code you've supplied, by itself, works fine. It breaks if you try to force the use of JSONP because the server you are making the request to doesn't support that. It does support CORS (which is the modern replacement for JSONP), and you don't need to do anything special...
javascript,jquery,html,css,css3
You mean do the entire animation in css3? var av_icons = ["http://img3.wikia.nocookie.net/__cb20111227211832/cjpedia/images/c/c5/503px-Luigiart6.png", "http://files.softicons.com/download/game-icons/super-mario-icons-by-sandro-pereira/ico/Mushroom%20-%201UP.ico", "http://icons.iconarchive.com/icons/yellowicon/game-stars/256/Mario-icon.png", "http://img3.wikia.nocookie.net/__cb20111227211832/cjpedia/images/c/c5/503px-Luigiart6.png", "http://icons.iconarchive.com/icons/yellowicon/game-stars/256/Mario-icon.png",...
You have to use addRow method to append data. Here is an updated fiddle https://jsfiddle.net/99x50s2s/69/ $('#new').on('click', function(){ i = i+i; var parameters = { initdata : {Id:i,invdate:"2007-10-02",name:"test"+i,note:"note" + i,amount:"300.00",tax:"20.00",total:"320.00"}, position :"last" }; jQuery("#sg1").jqGrid('addRow',parameters); }); ...
You need to use brackets notation to access property by variable: function myFunc( array, fieldToCompare, valueToCompare ) { if( array[fieldToCompare] == "Thiago" ) alert(true); } And wrap name in quotes: myFunc( myArray, 'name', "Thiago" ); ...
Give this a try: $("ul.tabs-nav").children().each(function(i) { var $this = $(this); // don't look for the same element twice $this.addClass("prefix_" + (i+1)); $this.find('a').attr('href', 'prefix_' + (i+1)); // find the link and add href }); ...