Using $(this) or this
<script src="https://code.jquery.com/jquery-1.10.2.js"></script> <p class='first'>p1</p> <p class='second'>p2</p> <p class='third'>p3</p> <script> $('p').after(function(i,v) { return "<div><b>" + $(this).className + "</b></div>"; }); </script> Output p1 undefined p2 undefined p3 undefined Why I can't use $(this) here? Why I must use 'this'?
Retrieve form data
I have a form with some fields, by a button I duplicate this fields n-times. <div class="noo-control-group"> <div class="group-title">Dati Catastali</div> <div class='count hidden'>1</div> <div class="box-group" id="accordion"> <div class="panel box box-primary"> <div class="box-header with-border"> <h4 class="box-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne"> Immobile
adding multiple classes has no effect
style .blue { color: blue; } .red { color: red; } .red.blue { color: blue; } .blue.red { color: red; } <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <p></p> <script> $('p').text('i can finally change color'); $('p').addClass('red blue'); </script> How come text is always red?
addClass() passing function as parameter doesn't behave as expected
<script src="https://code.jquery.com/jquery-1.10.2.js"></script> <p></p> <p></p> <script> $target=$('p').first(); $target.text('plz'); $target.addClass('red'); $target.addClass( function(i,c) { var added; if (c==='red') { this.removeClass('red'); added='blue'; } return added; } ); </script> <style> .blue { color: blue; } .red { color: red; } </style> The text doesn't turn blue.
How to Detect 40% in the Middle of a Div Using jQuery
Can you please let me know if it is possible to detect the 40% in the Middle of a Div Using jQuery for example in following example I need to enable the mousemove() only on 30% left side or 30% of the right side of the center. $('#box-wrap').mousemove(function(e){ var x = e.pageX - this.offsetLeft; var y = e.pageY - this.offsetTop; console.log("X: " + x + " Y: " + y); }); html, body{ width:100%; height:100; } #box-wrap{ height:400px; width:100%; background:yellow; } <div id="box-wrap"></div>
jquery IE 11 Issue
I am having issues with jquery dialog. It works using FireFox but not IE 11. The error message is: The value of the property '$' is null or undefined, not a Function object The script and code is: < script src ="Scripts/jquery-2.1.4.min.js"></ script > < script src ="Scripts/jquery-ui-1.11.3.js"></ script > $("#divAssignPopUp").dialog({ autoOpen: true, width: 600, height: 500, resizable: false,
Selected checkbox values and effects
Hi, This is my bootply... http://www.bootply.com/nAupRgzzAp I try to show selected checkbox values (for example, "Alpha", "Gamma", "Koppa", "Fifteen", "Two", "Seven"), below the filter-menus. So for example... when a user selected Gamma, Koppa, and Fifteen and Nine. Then: PRODUCTS AVAILABILITY separate DIVs with : Gamma (=div-1), Koppa (=div-2), Fifteen (div-3), Nine (div-4) Is there a plugin to accomplish this? How to get this done? Please help. I want to get something like this... https://www.zalando.de/damenbekleidung-pullover-und-strickjacken/__groesse-34.42/?upper_material=hardshell
Multiple choice questions
Hi, I'm having trouble making the answers show for this multiple choice quiz. The goal is for the question's background to become green or red depending on the answer. I want to make them all appear when I click on the Validate button but I can't get it to work. Thanks for any help you can give ! https://jsfiddle.net/0z4sz89c/ Calum
remove div
Hi there, with a button I add a group of fields in a form. I can't perform the remove action $('#aggiungi_catasto').click(function(){ var subCategoria = $('#subcategoria').val(); if(subCategoria.length<1){ subCategoria = 'Sub Immobile'; } $('#subcategoria').val(''); var count = parseInt($('.count').html()); count = count+1; $('.count').html(count); var groupId = 'group_'+count; var form ='<div id="'+groupId+'" class="panel
Help - jQuery Image Gallery
Hi Everyone, Im new in this Forum,Im looking for information, must to be easy for all, but for me is new, it's about Image Gallery, i have been looking around, but nothing looks similar. just something like this example After i click an image must be show something like this forward and back signs. somebody know something? i will appreciate. Thanks in advanced! Cheers!
binding inside a loop
hello - i currently have this code: jQuery('div.One').bind('click', function() { myFunction(1); }); jQuery('div.Two').bind('click', function() { myFunction(2); }); jQuery('div.Three').bind('click', function() { myFunction(3); }); this works great, as does this method (probably the same thing) jQuery('div.One').click(function() { myFunction(1); }); jQuery('div.Two').click(function() { myFunction(2); }); i am currently trying to put these values into a object and loop through it like
Uncaught SyntaxError: Unexpected token <
I am getting Uncaught SyntaxError: Unexpected token < error.can any one help me to find what is wrong with below code function SearchbyAttribute(filter) { $.ajax({ url: "http://192.168.1.137:8080/geoserver/school/wms", type: 'GET', contentType: "application/jsonp; charset=utf-8", dataType: 'jsonp', jsonpCallback: "parseResponse", data: { typeName: "typename=school:school", outputFormat: "text/javascript", service:
Jquery Image Uploader and generate thumbnail Which Supports IE 9 browser
We have Web Applications , where most of our clients are using browser IE only. We are trying the functionality of Image Uploading and Thumbnail generation in Jquery only. It is found that in IE 9 it does not works fine, unable to read file attribute. please let us know how to deal with this issue.
Get function work for new loaded elements
Hello, I am in front of a problem. I know this was discussed in this forum already but this didn't really help me. I am loading content with $.ajax and I am receiving a bunch of elements. ( In this case "posts" ). Now I wanted to work on and make the like / share function work but the elements don't react to the click. I already tried the .on() thing out. Either I did it wrong or it just does not work. I hope you can help me. // Load content var first_post; var last_post; $(document).ready(function(){
Jquery 1.7.1 in IE8
I'm using jquery 1.7.1 on my web, i tried to use ajax to get a HTML page, and then use 'find' method to retrieve some div from response data. All work fine except IE8, i attached the debug screenshot, please help me.
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'accordion'
@Scripts.Render("~/bundles/jquery") <link href="~/Content/themes/base/accordion.css" rel="stylesheet" /> <script src="~/Scripts/jquery-2.1.4.js"></script> <script src="~/Scripts/jquery-ui-1.11.4.js"></script> <script type="text/javascript"> $(document).ready(function () { debugger $("#divmain").accordion(); }); </script>
Tinymce in every modal bootsrap only working in the first modal
Hello, merry Christmass hope not to late lah to say, well quick question here is demo My goal is make all tinmyce should work in every modal, in my demo only first modal working fine but another modal not working, already googling i use jquery to detect modal open or shown then put configuration tinymce inside it, the script bellow here //first modal $('#myModal').on('shown.bs.modal', function(event) { //here is configuration tinymce }) Thanks for any respond, Best Regards Freddy Sidauruk
Canvas draw
I'm in the sign business and need a canvas script where a user can layout the sign that he want to order, the user must be able to drag and drop or upload cliparts and pictures on the canvas must also be able to type text on the canvas if possible Joomla 3 compatible
Understanding the function/object nature of jQuery and how it returns an object
I understand that in JavaScript all functions are objects which is why we can both call jQuery with arguments $() while also being able to access methods with dot notation. What I am less sure about is how, when we pass in css selectors into the jQuery function, it instantly returns a jQuery object. I am looking through the (old) annotated source code (which i realise has changed significantly - but i just want to understand the very basics of what jQuery is doing). This is the part of the annotated
Sorting array and inserting value at specific location
Hi, I have an array of 8 values all containing different numbers, https://jsfiddle.net/a4poster/9y45rg7x/2/ I want to be able to insert the value of the array at the zero index into its proper chronological order. However the way I am trying this leaves me with zeros at the start. I have explained what I am looking for in the comments within the code. Thanks in advance. PS, I have quickly put the example in Javascript but JQuery would be preferable.
Doesn't Retrieve the Value of Uploaded File Using Parameter
Goal: I would like to have the second input name "file2" to be uploaded automatically to the actionresult with support of the jquery code using the latest version of FF, CHrome and IE. Problem: It doesn't work because HttpPostedFileBase file2 is null. it is supposed to be contain any value based on uploaded file with support of jquery. Info: *It would be great that it would be working for IE, Chrome and FF. *There is a purpose why I'm asking about this unusual approach. *The sourcecode of jquery
Trouble with autocomplete
Im trying to get the value of an date input to use it with a php function which return a result that depend of the date entrend any Ideas <script type="text/javascript"> $(function(){ $("#Salle").on('input', function() { $("#Salle").autocomplete({source: 'conf/salle_auto.php?key='+$("#Salle").val()+ '&Datee=' + $("#Date_de_Soutenance").val() }); }); }); </script> <label>Date</label> <input type="date" class="typeahead tt-query"
JQuery AJAX Call Error
Greetings, I have an AJAX piece that is being sent to a PHP file. Below is the code for it. For some reason, I get the following error: allery.js:31 failed to send AJAX POST gallery.js:32 200 gallery.js:33 SyntaxError: Unexpected token U(…) gallery.js:34 User What am I doing wrong? On another note, how do I send a JS array over to PHP side and then parse it? Is it possible to send an array of arrays? Here is the snippet: $.ajax({ type: "POST", url: "write_db.php", cache: false, //contentType: false,
learning project: order list please help
Hi there, My name is Remco and I just finished reading my first book on JavaScript and jQuery. I’m trying to put my new knowledge to direct action in the shape of an dynamic order list. To put my intention to the test I created a simple table where every tr contains 4 td's; product picture, product description, product price and finally a checkbox which allows the user to add the specific product to his/her order list. Hope you guys won’t be too hard on me, keep in mind that this is the first piece
selector and any child
i though this would be a lot easier but for some reason i'm having problems to get my dragenter to work with .upload-container > child but it works with selector on it's own fine. i've also tried :child how can i please trigger an event on selector and any child please? $('.upload-container > child').on({ dragenter: function(e) { var dt = e.originalEvent.dataTransfer; if(dt.types != null && (dt.types.indexOf ? dt.types.indexOf('Files') != -1 : dt.types.contains('application/x-moz-file')))
Set equal height for programatically populated data
Dear Sir i am using following script to align certain part of website which is programatically (CMS) poulated or generated $('.typeofloandetail').each(function() { maxHeight = Math.max(maxHeight, $(this).height()); }).height(maxHeight); } This script is running really good and resizes / equalise the height of elements for class typeofloandetail However when, i populate the very same data again using Jquery I am using following jQuery for this purpose var url= "typeofloandivfill.php" data
Get the parent's sibling's text of menu with JQuery
Hi, I have a html like this. <ul> <li><a href="">Home</a></li> <li><a href="#">Women fashion</a> <ul> <li><a href="#">Women Pants</a> <ul> <li><a href="#">Women jeans</a></li> <li><a href="#">Women Breeches</a></li> <li><a href="#">Women trousers</a></li> <li><a href="#">Women shorts</a></li> </ul></li> <li><a href="#">Women blouse</a></li> <li><a href="#">Dress-Skirt</a></li> </ul></li> <li><a href="">Computer</a> <ul> <li><a href="#">Laptop</a></li> <li><a href="#">Desktop</a></li> <li><a href="#">Monitor</a></li>
select one and deselect another checkbox
I would like that my code deselect currect (selected) checkbox if another one is selected. Currect code allows multiple selected checkboxes. Here is the code: http://pastebin.com/2f2NrrFr Thanks for hints/answers.
can't create dialog
Hello, I'm trying to create a jquery dialog but it's not working. I'm hoping someone can tell me what I'm doing wrong. Here is my code: <html> <head> <link type="text/css" rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/jquery-ui.css"/> <script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script> <script src="http://code/jquery.com/ui/1.10.3/jquery-ui.js" type="text/javascript"></script> </head> <body> <div id="HelloDiv"> Hello </div> <script> $(document).ready(function()
Chrome Extensions: Uncaught Error: Syntax error, unrecognized expression: a[href^=file://]
Hi there, I have the following code for the chrome extension: But I got the following error. Does anybody knows what is the problem with this expression? Code var flag = 'Chrome_LocalLinks_extension_was_already_injected_in_this_document'; if (!document[flag]) $('a[href^=file://]'). live('mousedown', handleMousedownOnLink). live('mouseout', handleMouseoutOnLink). live('mouseup', handleMouseupOnLink). live('click', handleClickOnLink) document[flag] = true; } Error In chrome
scrollWidth of perspective image
I'm trying to find out the largest width of an image (including parts clipped by surrounding div) that has perspective css applied to it, such as this: -webkit-transform:perspective(50em) rotateX(60deg);I'm gotten to this point, but I'm stuck. It appears to be giving me the width measured along the x-axis in the center of the skewed image, but I need to know the widest width which is at the bottom of the skewed image : $(document).ready(function() { $('img').each(function() { $(this).load(function()
HTML form submit not submit with clone
I make a form, when page is loaded the form is hide at the end of page, when the specific button click the clone of form is show into the div in section and when the clone of form is submitted. its not submitted. I check when original form is submitted its work fine. but not its work with clone form. how to submit it. for example <div class="row"> <h1 class="text-center margin-top10 fsize60"></h1> <section class="text-center replace-section"> </section> </div> <script> $(document).ready(function
JQuery 404 Error
I'm using python 2.7's SimpleHTTPServer to host a local website to test the files on (already ran into the local problems). One error I keep getting is http://192.168.1.152:8000/function%20(a,b)%7Breturn%20new%20n.fn.init(a,b)%7D?callback=jQuery21405766850665677339_1450740082561&_=1450740082562 Failed to load resource: the server responded with a status of 404 (File not found) I'm new to JQuery and javascript in general, so I have no idea what I'm doing wrong. I've tried changing the path for game.js
Problem with opening a new Tab and showing a specific URL Based on item Clicked ----
Hello All, Greetings, I'm getting a few errors [well, outputs not as expected] on a scenario. I'll describe it. Basically, on my web page, I have several small image thumbnails. These are just images of some organisations/companies. Now, on clicking any of them, I wanted that it would open a new separate tab on the browser, and display a certain specific page; namely the careers page of that particular comp/org. That's it. Sounds brief and straight enough. What I did was like this:: The html markup
worry about using jquery.load
hello I'll use a div switch displays the contents of a navigation menu (use jquery.load), and now I worried about page of memory release problem after use load function for many times, you know, every page's javascript all load to the main page. If this is a problem?
Multiple Preview images diffrent height and width using cropit
Crop and resize images is a common issue build cms, so i found great plugin here that plugin working well in desktop and mobile touch screen but i have last issue in my project how can i make multiple preview in this page ! already look at the issue there and found someone post same like me issue, so i digging on here but not working, issue here then i checked jquery.cropit.js line 927 has class cropit-image-preview means will load images, so i make <form action="#"> <div class="image-editor">
combine all js in one file
how do i combine all my .js files into one js and add only 1 js to my page??? there are the same variables and functions names in those files!
How to add a class when my fixed logo overlaps a certain div?
Hello all, Thanks in advance for any help! So I have a fixed header and I need to add a class to my logo when the logo overlaps a certain div. So the whole time the logo is over top a certain div, a class is added to the logo. Anyone help?
problems with jquer 1.6.2 - "ixquery not defined"
An application i am working now uses jquery 1.4.2. i upgraded it and now i use 1.6.3. but after that i an facing some issue like dropdowns not working , cannot access the menu (ribbon) etc. it is showing 'ixquery' not defined. can any one pls help me, so that i could move with jquery 1.6.2.
JQuery not parsing the json_encode's output properly
Hi, I am trying to populate a SELECT from PHP and JQuery but the output from PHP is adding a backslash to the closing </option> tag and removing the <option> opening tag like this: Bank Facilities<\/option> Embassy<\/option> Government<\/option> here is my code: $( "#cboRequest" ).change(function() { if (!$("#cboRequest").val()) { $("#divPeriod").hide(); $("#divPurpose").hide(); return false; }; $.ajax({ type: 'GET', url: "get_request_processing_period.php", dataType: "json", cache: false, data:
Next Page