Need help using validator plugin
Hi, I'm using validator plugin (jquery.validate.min.js) to validate form fields. my form is built like this: <form action="<?php echo $base_url;?>create" method="post"> <div id="formstyle_editeven"> <ul> <li class="first">Name:</li> <li class="required"><img src="<?php echo $base_url;?>assets/css/images/asterik.gif" /></li> <li><input name="name" type="text" class="mform" value="<?php echo set_value('name');?>"/></li> </ul> </div></form> (this is a shortened version, but u get the idea).
Escaping html using ajax
OK, I've googled myself sick trying to find the answer to this question, but I can't seem to get a straight answer. Here's the setup: <a href="void();" onClick="jQuery('div#content').load('/cgi-bin/script.pl',{id:$id}); return false;">Link text</a> Clicking this link works great. The data is loaded into the content div as expected. But the problem is the html that is loaded into the div has funny-looking characters where the single and double quotes should be. (See attachment). What am I doing
Is the ":focus" selector valid?
I've noticed that the ":focus" selector does indeed work, though it is not documented anywhere. Is it safe to use? Can anyone explain this? And in a somewhat related question, is it possible to override a core selector? For example, is it possible to override the ":empty" selector to perform an additional checks in addition to checking whether or not an element is empty? I know that selectors can be chained together, but I'm wondering if it's possible to change the default behavior of a selector
help with selectors and attr
Can someone please tell me why the following doesn't work? <select name='s[columns][1]' id='s_columns_1'> <option>title</option> <option>body</option> </select> $('select[name*="columns"]')[0].attr('name') It tells me attr is not a function. $('select[name*="columns"]')[0] returns a reference to the select field but I cannot access or update any attributes. Here is my full code if you want it. <!DOCTYPE html> <html lang="en"> <head> <script type="text/javascript"
Using jQuery with json - i keep having "ui is undefined"
I have a link (#botaoMovimentos) and, by pressing, it returns data from mysql. The sql query is ok. I've tested. But i keep getting this error (ui is undefined). What is missing in here? #tabelamovimentos is a Div with a table. #botaoMovimentos is a link that redirects to #. I have the index.php file with this code; $('#botaoMovimentos').bind( { source : 'ajaxMovimentos.php', click: function(event, ui) { $('#tabelamovimentos').slideUp('slow', function(){ $('#tabelamovimentos').html( '<h2>Detalhes
Escaping html for <input> tag
Is there any method for <input> tag like .html() to escapsing html code? Example with a label, I can use: $("#label").html("NGUYỄN") will become NGUYỄN (that what I want); so I want to do the same thing with <input> tag. Sorry for my English
Convert a table into an accordion (special case). Please help.
I've been wrestling with this for too long and am exasperated, please help if you can. I'm working with a common CMS issue where a table presented. All rows contain two columns. Some rows should be headers as they contain H3 elements in the second column leaving the first column's only content a single non-breaking-space. The in-between rows contain labels in the first column and the second column contain input elements. So it looks a bit like: table tr td - span - nbsp - /span - /td td
Have to Double Click scroll button using JQuery Tools Scrollable after page load
I recently added a section to my website that uses the Scrollable JQuery tool to load images from my Flickr account. When I initially load the page the "next" button requires two clicks before it will advance to the next set of images. This only happens on the first attempt following the page load. When I look at the code it appears that Scrollable fires an event on the first click that removes the "disabled" class on the "prev" anchor tag. It appears to skip the slider event that scrolls the images.
Basic Function Won't Work
$(function () { if (name=["DayOfBirth"].hasClass('error')){ (name=["MonthOBirth"]).removeClass('error') (name=["YearOBirth"]).removeClass('error') } if (name=["MonthOfBirth"].hasClass('error')){ (name=["DayOfBirth"]).removeClass('error') (name=["YearOBirth"]).removeClass('error') } if (name=["YearOfBirth"].hasClass('error')){ (name=["DayOfBirth"]).removeClass('error') (name=["MonthOBirth"]).removeClass('error') } });
why does [XMLHttpReequest] object Message come?
I am calling below javascript method from code behind then, why does [Object XMLHttpReequest] Message come? function SendMsg() { var user = document.getElementById('<%=User.ClientID %>'); var val = user.value; var nonrno = 1234; var rno = 123; var options = { type: "POST", url: "Test.aspx/SendMessage", data: "{'toMailAddress':'" + val + "','rno':'" + rno+ "', 'nonrno':'" + nonrno+ "'}", contentType: "application/json; charset=utf-8",
Jquery/Ajax Form Issues
I'm not sure if this is a php issue or jquery issue. When I complete the form and hit submit it puts the successful message up like its supposed to but also with the fields still filled in the form which it shouldn't be doing and it doesn't actually post in the database so I'm not sure if its a php issue or jquery issue. <?php // Include the database page include ('inc/dbconfig.php'); if (isset($_POST['submittemplate'])) { $templatename = mysql_real_escape_string($_POST['templatename']);
jQuery and PHP/Oracle interaction
Hi everyone, I'm building a small web system for a group project in my database class. Basically how this works is someone searches for flights by departure city, destination city, date, and time. From there, results are shown in a table and users should have the ability to select which flight they want using a button next to each table entry. Then users input their personal data (first name, last name, age, number of bags) and then submit that form to be taken to a confirmation page. As of now,
Why does my below code not work in Safari and firefox?
Why does my below code not work in Safari and firefox? The below code does not call my page method. but it works on IE. Is there any thing need to enable Ajax mehod call. function SendMsg() { var user = document.getElementById('<%=User.ClientID %>'); var val = user.value; var nonrno = 1234; var rno = 123; var options = { type: "POST", url: "Test.aspx/SendMessage", data: "{'toMailAddress':'" + val + "','rno':'" + rno+ "', 'nonrno':'"
what does apply() mean
I ran into this code and cannot find a reference in the jquery API $li.click(function(e) { setCurr(this); return o.click.apply(this, [e, this]); }); What does apply() mean? Thank you
[jQuery] use jquery script from parent of iframe
Quick question. There is a parent page that uses jquery and iframe in that page, which loads a page that also uses jquery. I would like the child parent to use the parent's instance of jquery. i tried: <script type="text/javascript">var jQuery, $; $ = window.parent.$; jQuery = window.parent.jQuery; </script> which actually loads without error, and even allows some of the childs jquery functions to work, but others don't or work poorly (throw errors). is there another/better way to do this? everything
jquery with CHtmlView of MFC
i planned to use jquery to my MFC application with CHtmlView. i found that CHtmlView::OnDocumentComplete was called after jquery's $(document).ready(). how can i call C++ function before call jscript $(document).ready() function?
Window Unload overwritten
I am trying to add jQuery to a very large project that has many parts owned by teams outside of my own. I noticed that several of our pages have inline (or asyncrous script which could occur before/after jQuery)for the window.onbeforeunload event. When jQuery evaluates after our inline script (or async scripts) it seems to blow away the previous window.onbeforeunload method. beforeunload: { setup: function( data, namespaces, eventHandle ) { // We only want to do this special case on
Convert, strip or encode html characters (<,>,", etc.) to put in a form.
Hi, I'm creating a page where the user can place images in a <div> by using the drag & drop and resizable plugins. Everything works fine, but I'd like to save the generated css (position, size, etc) in a form to post it in another page. The only solution I see is to clone the div in a textarea or an hidden input, but I don't know how to change the html characters (<,>,", etc.). Can someone save me please ?
jQuery 1.4.4 selector problem in IE8
Hi, I have 18 check boxes (all checked) on a page, with one of them disabled, based data bound values. I have a few examples of IE8 not responding like FF, with FF giving the desired results. $('input[onclick="chkClick();"]:not(:disabled)').size() works in FF, but not in IE8. FF returns 17 check boxes, IE8 returns 0. $('input:checkbox(:disabled)').size() returns 18 in IE8, when only one is disabled. FF returns 1, as it should. $('input[onclick="chkClick();"]:checked').size() returns 17 in FF
Problem with hover
Hi again, I have a problem with hover and click, My intention is that if the mouse is over a header, then the header should be underlined and bold, and if the header is clicked, the header should stay underlined and bold, but only the clicked header, if another header is clicked than the other headers should be not underlined and bold but the clicked header should be underlined and bold. Does anyone know how I can do this? Thanks a lot, All the best, <div id="latestNews"> <div id="latestNewsHeader">Letzte
Form Observer help
I found this code on google. I want to watch a form for changes. If changes are made and user navigates away from the form, I want to popup a warning. If user clicks submit I want to process the form as usual. Currently the former is working find, but I also get a warning on submit. Here is a demo site... https://q3ait.org/js/testobserver.html Here is the js code... /** * jquery.popupt * (c) 2008 Semooh (http://semooh.jp/) * * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL
Custom Regex pattern
My question is how do a custom Regex. This one below works ok, it stops "every" special characters. regex:"^[a-öA-Ö'.\s]{1,40}$", But supposte I do want to allow some of the special characters, in my case I want to allow - and space. Is there some application maybe on the internet to just put in exactly every charachters you want to dissallow, like building a custom regex pattern? Any guides would be great here, I don´t know about construction of regex patterns. / Cheers
$.ajax POST and Http headers
Hi all, i want to call a web service from jQuery AJAX method, it is working perfectlly, but i have a big request, look at the example i attached. It is 1,567 bytes length. i only need to pass 2 bytes and i receive gzip data (around 300 bytes) i want to reduce as much as possible HTTP overhead by removing (at least) Referer and User-Agent. i tried with beforeSend but it is not working. any idea on how to do the trick? Thank you POST http://www.site.com/XXX.asmx/GetThis HTTP/1.1 x-requested-with: XMLHttpRequest
AJAX get problem with varible
Hello, I would like to ask you how to get the value of variable "data". This not working: ... else if (field == 'username') { $.get("register.php", {check: content1}, function(data) { if (data == 'ok') {ok = 1;} else {ok = 2;} }); } ...And this working, but I don't want any alert. ... else if (field == 'username') { $.get("register.php", {check: content1}, function(data) { if (data == 'ok') {ok
How to react on connection refused errors on AJAX requests?
Hallo, how can one react on connection refused errors when doing an ajax request with $.ajax()? I installed an error handler which should retry (after a certain timeout) to connect to a backend server by calling $.ajax(this);, but this error handler only works if there was any HTTP error, but not on "deeper" network errors like connection refused if the server went offline in meantime. I'm looking for a way to retry to connect to the server e.g. each second until the connection is established again.
Separating HTML in Ajax request?
I'm using ajax like this (from the docs): $.ajax({ url: 'ajax/test.php', success: function(data) { // do something with data } }); The test.php prints a lot of HTML <div id="content1"><div id="test">test</div> testing more</div> <div id="content2">testing more</div> <div id="content3">testing more</div> What I want to do is to fetch different parts of the HTML (in this example #content1, #content2, #content3) so I can update different parts of the page with the contents of these divs. I cannot seem
jQuery won't bind events to <object> elements
It looks like when I do $("object").bind("<mouse-event>") the event isn't actually being bound to the element in Chrome and Firefox (not sure about IE). Using $("object").each(function() {this.addEventListener(...)}) works fine though. I may have done something wrong (sorry if so). Here's an example page (it won't let me upload a .html for some reason). The commented out portion works, the uncommented part doesn't. <html> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script>
How To Let A Message Disappear After x Seconds?
Hello, Does anybody know how to let a message disappear after x seconds? It does work, but disappears almost immediately and then trows an error :( This is what I have for now: $(document).ready(function() { $('button').click(function() { var message = 'Feedbackmessage'; feedbackMessage(message); }); function feedbackMessage(message) { self = $('#feedbackMessage'); self.empty().append(message); setTimeout(self.fadeOut(), 3000); } }); Live example -> http://jsbin.com/omubo4
Using livequery to load external javascript into a div layer
Forgive me, I'm not a UI developer at all. I have a messy site with lots of JS/jquery, that loads the primary content for the home page from "index-ok.html" using load(): $('#main').load('index-ok.html); Inside index-ok.html is a div element with an id of "ad", ie: <div id="ad"></div>I need to display some javascript inside of the 'ad' div, that will display some google adsense ads - just inserting the google adsense js code inside of index-ok.html absolutely does not work, so I'm trying to load
Getting the Element ID of the "Selected" item in a list
I have a bunch of DIVs (not an <option> List) each of the class "SongListItem". For one of the DIVs at a time, I set a "Selected" attribute, so it sort of acts like a ListBox. So two rows in the list might look like: <div id="Item1" class="SongListItem">Item 1 Text</div> <div id="Item2" Selected="True" class="SongListItem">Item 2 Text</div> Now I want to write a jQuery function which gets the ID of the SongListItem div that has Selected="True". So far, I have tried: var SongID=
Fading in a (timed out) div
Hi there, I'm fairly new to using jQuery so this question could be pretty lame. I'm looking voor the right syntax to fade in a div. So far I only found syntaxes that deal with button actions but I just want to fade in the div after a few seconds. How do I set that up? Switch off visibility with css and then? Tia.
jQuery API XML - how is it maintained?
Hi guys, I've looked at the VSDOC generator which uses http://api.jquery.com/api/, wihich returns a big XML document for the API documentation. I'm wondering , how is this maintained? How do you ensure it is in sync with the source code? Whenever something changes in the code, does someone have to manually edit this XML? Thank you
[jQuery] Beta Testers needed for Form Plugin file upload support
I've added file upload support to the form plugin and I could use some help testing it out. If this feature interests you then go ahead and grab the beta plugin at: http://malsup.com/jquery/form/file/jquery.form.js File upload support is baked right into the plugin and there are no external dependencies. The plugin will automatically detect file input elements and use an iframe to submit the form if there are files to be uploaded. No extra coding or metadata is needed to take advantage of this new
Emergency Help About Nested Accordion
I Used Nested Accordion In My Project by Event Click , But I want Accordion Expand Only By Plus Gif Image and Collpase By minus Gif Image Only. No by Title click such As Tree Please Help me
Positiong element ouside the viewable area of the website
let's say we have a div. it is visible all the time, it's not hidden, but let's say it's on the bottom of the page, so to see it we should scroll down the page. the Task to position a close button in that div. the Problem: .position doesn't position the close button where it should be if the div is not in the viewscope. but if it is, it's positioned correctly. <fieldset id="generatedCode" class="smallBlock textAreaField"><span class="tooltip-s ui-icon ui-icon-circle-close" id="clearCode" title="clear"></span>
reading out an xml (working) and returning the value as a string (not working yet)
For a site I'm working on I have a function that reads out an xml and needs to respond if an item starts with "MUZ ". Currently I have this snippet of code: function itemCode() { $.ajax({ type: "GET", url: "http://ican'tsharethisurl.so/sorry.xml", dataType: "xml", success: function(xml) { // I create a variable that holds the (unique) id var itemcode = $(xml).find('Current itemCode'); // I create a variable
Scrolling a DIV smoothly
hey guys, im trying to scroll a DIV with images inside based on the mouse position inside the DIV, but I'm not getting a smooth transition, it doesn't flow too well. What could I do to improve the movement? This is the page: http://iljamess.de/index_galerie.html
getJson and iPhone4 issue
I am in the middle of building this website for mobile/iphone well everything seemed to be going all ok, built a page using json data using the getJson function all ok on my 3G iphone, but when viewed on my colleague iphone 4, the code did not show? There was no error nothing just did not run the code within the getJson function. MY CODE: //-- this log will show on both iphone 3G and 4 console.log('begin json '); //-- the log and code within will not show in iphone4 safari mobile but
radiobutton check
hi i have an asp.net radiobutton control and want to get the selected value in jquery the control is coded as this <asp:RadioButton ID="radFree" runat="server" GroupName="deliveryoptions" /> <p><span class="selection-free">(FREE)</span> First Class Recorded (1-3 Business Days)</p> <br class="clear" /> <asp:RadioButton ID="radSpecial" runat="server" GroupName="deliveryoptions"
Hide Div if Screen is Smaller than 1024
hi there.. i want to hide a floating div if the user screen is < 1024 as it will overlay with my blog content area. i found this jquery on the net i am not sure how to use it. $(document).ready(function() { if ((screen.width>1024)) { // if screen size is 1025px wide or larger $(".yourClass").css('display', 'none'); // you can also use $(".yourClass").hide(); } elseif ((screen.width<=1024)) { // if screen size width is less than 1024px $(".yourClass").css('display', 'block'); // here you can also
Next Page