Need help selecting numbers only in a div element
Hey Guys. I have a quick question. I am trying to select a float in a div element that also contains a string. Is there a way I can filter so it just get the number? Another alternative is to wrap the floating number in a separate element, but I would rather use jQuery to filter out the text so it can get the number. Below is my HTML code <div id="grand_total" class="totals">Grand Total = $7.57</div> $('#tip').change(function() { var $tip = $('#tip').val(); var $total_amount = $('#grand_total').text()
getJSON problem
This code does not work chrome debugger says received an invalid response origin is null therefore not aloud access. This is the same for both local machine and web host. <script> $(document).ready(function(e) { $.getJSON("JS/testobject.js",function(data){ $.each(data,function(key,val){ $('body').append(key + ":" + val +"<br />"); }); }); }); </script> The JS/testobject.js file contains the following var data = [ { "key": "value", "key": "value" },
Server side pagination using Jquery tablesorter pager and ColdFusion is not working
In my application I am using Jquery table sorter and pager.I need to do server side pagination using this pager's ajaxURL and ajaxProcessing options.I am using server side language as coldfusion. When I call a cfc method using this ajaxUrl option in pager I am getting "Uncaugh error :OK[200]"in the table cell. Here is the code that I am using ================================= $(document).ready(function() { $("#myTable") .tablesorter({widthFixed: true, widgets: ['zebra']}) .tablesorterPager({
create as animation (cartoon) in jquery
Hi, Everyone Is there any plugin or something to animate images as a cartoon animation? Creating a cartoon animation by jQuery! thx
Refresh only a div every 30 sec
is it possible to refresh a div every 30 seconds without calling in an external page. for example there is a div called #sample and i want #sample to refresh every 30 seconds.
Inserting a button in <td> on condition.
Hi everybody, I'm still here because I need your help to realize something like that: I have an html table, when value of <td> is > 6 I would like to color it red and when I click on it, it runs a js function. But only when the value inside <td> is < 6. I have a function that color the value inside <td> in red when it is < 6: $('input[name^="voto"]') .keyup(function() { $(this).toggleClass('highlight', parseInt($(this).val(), 10) < 6); }).keyup(); Thanks in advance. Tegatti
How to get the position of cursor?
Hi I am trying to include many different hover selectors on just a simple img tag. They would just explain each part of the image in words. Because I cannot work with classes or IDs, I will need to find out the current position of the cursor first. I tried it this way but the problem is, if I resize my browser the values are no more the same. Is there a way I could fix this problem or is there another way to realize what I want to do?
How to access data in callback function?
My problem is that I want to hit an external api with an asynch callback function in a loop, and I need access to the loop index in that callback function. In this case the external api is the Google Directions Service, but that really isn't the key point; could be any api whose signatures I can't control. Anyway, my jQuery skills are only at the advanced beginner/intermediate level, but I managed to read up on the jQuery Deferred object and create code that serializes the asynch calls to Google's
Access new appended DOM element
Hello there, I'm trying to create a form with an undefined number of elements. It's in a table, the "add" capability came from a choice, and I want to insert the new element (my "test" row actually) just before the 'adder' element (created with jQuery). So my actual code is: jQuery(function($){ $("input[name='ptype']").change(function() { var adder = document.createElement('tr'); adder.setAttribute('id', 'adder_1_1'); adder.innerHTML = '<td class="trow1">Add :</td><td
Issue on Updating jQuery setTimeout()
I am trying to make a simple plugin to calculate date and time by this code: <div id="timer"></div> $.fn.timeCounter = function(time) { var target = new Date(time); var now = new Date(); var timeDiff = target.getTime() - now.getTime(); if (timeDiff <= 0) { clearTimeout(timer); } var seconds = Math.floor(timeDiff / 1000); var minutes = Math.floor(seconds / 60); var hours = Math.floor(minutes / 60); var days = Math.floor(hours / 24); hours %= 24; minutes %= 60; seconds
checkbox handler not working
I have a very simple setup but for some reason, the event handler for a checkbox is not firing. first my php outputs a bunch of check box options based on admin input in the back-end. The result outputs checkboxes like so: <div class="span2"> <input type="checkbox" name="Veg" value="BLACK OLIVES">BLACK OLIVE </div>My javascript file is also super simple and I can see it in the inspector being loaded. $(":checkbox").change(function () { alert( "Handler for .change() called." ); });Not exactly
making data available outside the doc.ready function
I am building an app using backbone....the backbone code is enclosed in the familiar document.ready function. And the file where this code is located is imported(with the usual method in the header of a page) in a PHP script. What I am trying to do is a variable that is inside the document.ready function,I want to make it available in the PHP script....an example will illustrate the case I think. $(document).ready(function() { var john='45' }); <?php <div id="test"> document.write(john); </script></div>
Triger "function" after scrolling by an element. [Solved]
Dear JQuery Forum UsersHi, I'm trying to execute an "animation" when the user passes by(scrolling) a specific element( e.g.: "div" ). After trying many online tutorials and solutions about that I still haven't find something that fits for what I'm looking for. Could anybody suggest me something? (If you want me to post some of the code that I've already tried, Please inform me) Thanks a lot, -Pain-
Passing parameters to url
Hi, I am new to javascript and jquery but found it very useful for what I am trying to do. I found a sample code online, which uses jqGrid with local data: http://jsfiddle.net/hE2GB/. I have added a line "url: 'api/editSelection'" similar to the example code below to editsettings {} on line 114. My question is: How do I pass dynamic parameters to a url i.e. within the function below instead of zipcode = 97201, I'd want to use an array element zipcode = grid[0].p.selrow? $.ajax({ url: "/api/getWeather",
please assist with an easier way to call a function
I have an image which on hover a div appears below the image. The problem is I don't know the easiest way to handle the functionality for multiple images. Right now all of the images have the same class (item) so the hover effect occurs on all the images at the same time, and I only want the effect to occur when hovering over each image individually. The CSS code is: .VFP a:link, .VFP a:visited, .VFP a:active{ color:#fff; opacity:.5; text-decoration:none; } .VFP a:hover{ color:#fff; text-decoration:none;
JQuery .load() only working in safari
Hi there, I'm trying to load in an external href into a div on my webpage and then apply CSS to it. I am using JQuery .load() to load in the html and it works great in safari and my CSS applys to it. But when I open it using Chrome, Firefox or IE it doesn't load the html into the div. I was wondering if there are any other solutions for doing this? I've read in places you've got to change your settings using terminal but that is not an ideal solution to an average user. Hopefully someone can help
find value of cell value using jquery
Hi I want to find the value of above cell in a grid view using jquery i tried following code if ($.trim(cellText) == "0") { $(this).css('background-color', 'Red'); var $this = $(this); var $tr = $this.parent(); var col = $tr.children().index($this); alert(col); } above code returns only index value . ineed the value of that cell how to find out regards Baiju
This is the code Im working with, the problem here is i should get content from server and show it in Dynamically created Div and php pages are working correctly
$(document).ready(function(){ $(function() { $('#custom_timings_section, #custom_timings_section1').attr('disabled','true'); $('#change_timings').change(function(){ if($('#change_timings').val() == 'custom_timings_select') { $('#custom_timings_section, #custom_timings_section1').removeAttr('disabled'); } else { $('#custom_timings_section, #custom_timings_section1').attr('disabled','disabled'); } }); }); $("#addcategory").click(function ()
Can not load custom JS added on custom master page of sharepoint online, on MDS Enabled site
I have created custom master page and added custom js to that master page using scriptlink tag.But once MDS feature is enabled on site, master page can not load custom js, it gives js load error on the same page. Regards, Amarja
ajax ruins .each or .wrapAll (jQuery 1.7)
I have a list of (Drupal) teasers that have a read more link after each one, and separate divs of the full complete text I need to show when the read more link is clicked, following the links. Here's the JS: $('.comment-teaser').each(function(){ $(this).next('a.read-more-link').andSelf().wrapAll('<div class="teaser-n-link"/>'); }); $('a.read-more-link').live("click",function(e) { e.preventDefault(); $(this).parent('.teaser-n-link').slideUp(400,function(){ $(this).parent().parent().find('.show-text').slideDown(400);
jQuery.extend is not a copy for Object!!!
var A = { info:{ name:'a' } }; var B = extend({}, A); B.info.name='b'; console.log(A); // A.info.name is change to b
number of rows inside a div using jquery
Hi Guys, I wanted to find number of rows used inside a div. I used below code but it is not working. Jquery Code =========== $(function() { var addDiv = $('#bkup_docs'); var i = $('#bkup_docs tr').length + 1; alert(i); }); HTML ==== <div id="bkup_docs"> <tr> <td align="right"></td> </tr> <tr> <td> </td> </tr> </div> Here I am getting output as 1,actually it should be two. AM I missing something or I cannot do like this. Your help is well appreciated.
Issue with jQuery Mobile Documentation
It seems that the directory for the Transitions documentation has been replaced with the directory of its parent. Go to: http://demos.jquerymobile.com/1.4.2/ and attempt to click on the Transitions link on the bottom of the sidebar. It takes you to the same page that you were already on, but the url now reads: http://demos.jquerymobile.com/1.4.2/transitions If you click transitions again, you get a 404. It seems that the directory for the 1.4.2 Demo was copied into the Transitions directory and
Multiply second value from array to dropdown selected
I have created a row of drop downs with each option having its own value, as usual. But what I need to do is multiply a second value per drop down to the options values. I understand the process of whats needs to be done, but I don't know where or how to add this extra figure in. Her is it in action in this fiddle - http://jsfiddle.net/c9r48/8/ In the first dropdown for instance it has a label of 'label 1' the options values of: label: 'Label 1', value: '400', options: { '12': 'Monthly', '6': 'Bi-Monthly',
Anglo jquery?
Hi, Has anyone heard about Anglo jQuery? I was stumped when somebody asked me. Any website for more inputs? Also, how many of these kinds are there? (if et all) Thanks in adv...
Using Droppable+Accordion Jquery widgets to create a multi-selector
Hello, I am pretty new to Jquery ( and to JavaScript at all, in fact), but I think I am beginning to grasp the general idea, at least as far as the UI part is concerned. I hope you can help me to get from crawling to running I guess... anyways... I am trying to build a UI for fields/values selection. In principle the users have to assemble a list of fields for the query and then possible values for each field ( it brews down to a sql select statement, something like "select... where field1 in ( f1v1,f1v2,f1v3...)
Jquery Lavalamp sub menu
I am trying to add a submenu to a Jquery lavalamp, but i dont know how. This is what i made so far. The only thing left i think is to set hover over submenu items. code: HTML: <ul class="lavaLampWithImage" id="lava_menu"> <li><a href="#">Menu 1</a> </li> <li><a href="#">Menu 2</a> <ul class="sub-menu"> <li> <a href="#">Sub Menu 1</a> <a href="#">Sub Menu 2</a> <a href="#">Sub Menu 3</a> </li> </ul>
embed dropdown into html form using jquery
Im trying to embed a drop down to a form using jquery, and the dropdown itself isnt appearing. The idea is that a user clicks a link and this function is called and the form is created, im far off where i need to be but im working with little steps and each day is a challenge as I'm sort of learning on the go. hopefully you will see what im trying to do [code] <p><a href="#" onClick="active_tiptip()">Form Click</a></p> <div id="test" style="position:relative; width:100%; height:200px; background-color:#FF0000;">
Dynamic JQuery query generation to “disable” a drop down “option” in JSP
I am working with Servlet and JSP. I have a JSP form in which I have a drop down list with `id's` associated with it, as of now I have three options in the drop down list. HTML CODE-- <form id='form' method='post' action='/test/'> <select id="type" name="typeOne"> <optgroup id="first" name="First" label="FirstDiv"> <option value="value1" id="001">valuee1 count</option> <option value="value2" id="002">value2</option> <option value="value3" id="003">value3 </option> </optgroup> </select> </form>
jQuery with windows mobile ?
I'm trying to use jQuery 1.11.1 with Windows Mobile 6.1 and IE. The platform is Honeywell Dolphin 9900. I seems not working at all. Do I have a chance to make it work with this configuration ?
toogle effect in joomla 2.5
hi new on jquery, use it for the first time. Iam looking for this effect on this website. http://www.pixolith.de/team/ but i dont know, how can i use it in joomla. how is the code? ive install eorisis_jquery_system_plugin_1-1-5 in joomla extensions. looking for support. thx cheerz
.offset() >>> Uncaught TypeError: undefined is not a function
I am getting an an error when I try and use certain jquery functions. I presume I don't have some js file included that I actually need... but I can't tell what it is (after much googling)... My code fails when I call requiredFields[i].offset(). It finds the object and gives me the offsetLeft and offsetTop perfectly well... it just seems to be certain functions that I would expect to be available. $(function () { var requiredFields = $.find("[data-val-required]"); var page = $.find("div#page")[0];
How do I change the size of the thumbnails on this jquery slider?
<div class="wrap"> <div id="gallery"> <ul> <li><img src="gallery/thumb/img_1.jpg"/></li> <li><img src="gallery/thumb/img_2.jpg"/></li> </ul> <img src="gallery/img_1.jpg" alt="" id="main-img" /> </div> <div id="rectangle"></div> <div id="rectangle2"></div> </body> <footer> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/JavaScript"> // prepare the form when the DOM is ready $(document).ready(function()
jQuery and forms
I need to make the value of a few forms change automatically the text at another single form, but I just can do it with one of the forms. When I do it with the others, it doesn´t work any more. How can I do to do it with all of them? This is the code that works with one form: <script> $(document).ready(function(){ var x1 = $("input[name='x1']").val(); var x2 = $("input[name='x2']").val(); var x3 = $("input[name='x3']").val(); var x4 = $("input[name='x4']").val(); $("input[name='x5']").on('keyup',
"Optimize Selectors" guide requires update?
Original document: http://learn.jquery.com/performance/optimize-selectors/ // Fast: $( "#container div.robotarm" ); // Super-fast: $( "#container" ).find( "div.robotarm" ); The .find() approach is faster because the first selection is handled without going through the Sizzle selector engine – ID-only selections are handled using document.getElementById(), which is extremely fast because it is native to the browser. JSPerf test: http://jsperf.com/jquery-find-checked-checkbox (see the stats) $('#nav-sidebar').find('input:checked') vs
is element in list
Hello all I have next problem. I make li list when i register user, and when i try login i wont to check is this value from login input, exist in my list in some element from list. How to do that?
Some problem with using post in jquery
Hi, I am using 1.10.4 I am trying to login to my mediawiki api, through a jquery script. This requires me to send 2 Post requests one with the username and password and second with the token received with the first request. When I do these 2 post requests, using the Chrome REST-client extension, I receive a success result in the 2nd post response. But using the jquery script, I am unable to do this. I mean instead of a success, i receive a NeedToken on my second response, which should actually give
Parsing JSON Data From MySQL Table to Different Divs
Having a jQuery Ajax request from MySQL database I know how to render the data in an HTML element format like tables or list as below: $.ajax({ type:"POST", url:"appdata.php", success: function (newdata) { $('#result').html(newdata); } }); The PHP as: $mysqli = new mysqli('localhost', 'root', '******', '********'); $resultStr = ''; $query = 'SELECT * FROM appusers'; if ($result = $mysqli->query($query)) { if
Check box not checked inside dropdowncontrol change event in jquery
I want to check a chxkbox inside dropdownlist change event my code is like below $('#ddlrole').change(funtion() { $('#namecheckbox').attr('checked','checked'); }); my checkbox and dropdownlist is like below @Html.DropDownList("Roles", new SelectList((IEnumerable<EmployeeManagementSystem.DAO.RoleMaster>)ViewData["Roles"], "RoleId", "RoleName"), "Select Role", new { @id = "ddlrole", @class = "med m-wrap" }) @Html.CheckBox("CheckBox", new { id = "namecheckbox"}) but its not working anybody help
how to hide session value in browser in jquery
i am creating session in html web application in that in browser the session value is displaying can u hide it or encrypt or decry pt it? how to provide security for my session value?
Next Page