jquery

jQuery get height & width.

$(document).ready(function() { var pic = $(".pic"); // need to remove these in of case img-element has set width and height $(".pic").each(function() { var $this = $(this); $this.removeAttr("width"); $this.removeAttr("height"); var pic_real_width = $this.width(); var pic_real_height = $this.height(); if(pic_rea...

How to check which <option> is actually clicked?

$('select').bind('click contextmenu',function(ev){ }) ev.target is always a select,not option. How can I know which one is now being clicked? Don't tell me to do this: $('option').bind('click contextmenu',function(ev){ }) Because it's not supported in IE8,and you can test it yourself! EDIT It should also support right click,wh...

JQuery height condition

$(document).ready(function() { var pic = $(".pic"); // need to remove these in of case img-element has set width and height $(".pic").each(function() { var $this = $(this); $this.css({width: 'auto', height: 'auto'}); var pic_real_width = $this.width(); var pic_real_height = $this.height(); if(pic_real_width<100){ ...

Append element in IE7

Hi there, I append a select-element to a DOM-Node and fill it dynamically, which works good in Firefox and Safari. Unfortunately, when I click on the select-box, it simple does not drop down in Internet Explorer. Any ideas what goes wrong here? $('<select size="1">').appendTo( $('#mytable tbody') .find('tr:last') ...

can jquery and javascript co-exist in a file?

can i use javascript and jquery both in a page? like: <script type="text/javascript"> $(document).ready(function(){ //some jquery }); function xyz(){ //javascript statements //some jquery statements } </script> ...

button click function not working on IE?

Hi, I have the code below and everything works but the button click function on IE I have played around and still cannot seem to get it working. $(document).ready(function() { $("img").hide(); $("#logo").show(); document.getElementById("fname").focus(); $(".button").click(function() { postdata(); }); }) function postdata() ...

Google Maps markers not displayed in IE7

I managed to load the map cross-browser but when it comes to populating it with markers, it doesn't work in IE7 (markers are not displayed). Everything's fine in Firefox. The locations are stored in XML which is then parsed by javascript and markers are added. XML structure: <?xml version='1.0' standalone='yes'?> <stores> <store...

How to display an email address for users but hide from robot? Is there a simply way to do it using PHP, Javascript or Jquery?

Is there an elegant and easy/simple way to do it using PHP, Javascript or Jquery? ...

JQuery form tooltip

In a big form, I want to display additional information on each form field when they are active, something like this: So each form field has an associated tip text, and this tip text is displayed on focus. Something linke this in html/javascript: <input type="text" id="VIN" name="VIN" class="tooltipped"> <label for="VIN" class="for...

When should i wrap a DOM object with $()?

Using JQuery: Sometimes, I can do variable.val() and it works. Sometimes, I'm required to use $(variable).val(). I want to be able to make the choice without trial-and-error. Does anyone know when to wrap an object with $() while using JQuery? ...

jquery expression in parent window not working properly from popup window - whats wrong?

i am refreshing parent window from popup window,then calling parent window jquery expressions not works. But when i enable the alert call in closePopup function in the popup.php everything works fine. - whats wrong with me? file test1.html <script type="text/javascript" src="jquerymin.js"></script> <script type="text/javascript"> var ...

other ways to write this markup

Hey All, <% if (isTrue){ %> <div id="myResults" style="display: none;"> <% } else { %> <div id="myResults" > <% } %> Is there another way to write the preceding? The only difference is displaying it or not based on a condition. Thanks, rodchar ...

JQuery Tablesort with hidden rows?

I have a table which uses the jquery hide() and show() to manipulate the standard view. However when i include the table sort it only sorts on the visible rows and not the hidden ones. Is there anyway to get it to sort on all the items? ...

jQuery UI dialog dynamic height and width

Hi, I'm using jQuery UI dialog with an iframe: function showDialog(url, title, refresh){ var horizontalPadding = 30; var verticalPadding = 30; var width = 650; height = 800; $('<iframe id="modalIframeId" allowtransparency="true" style="background-color:#c0c0c0;" frameborder="0" class="ModalIFrame" src="' + ur...

JQuery tr add class after first 5 rows

Hi there... i have n-tables on a page. I need to go through every table on the page and within each table i need to add a class to the rows but NOT the first 5 rows. my current js: $('.selector').each(function(){ var trCount = $("tbody > tr", this).size(); alert(trCount); }); this goes through and tells me how many tr's i have...

Jquery id not found when added with insertAfter

After a page is loaded a user can add some text and with every add, I add a little 'x' so the text can be removed. But when I create a click event on the id of the 'x', nothing happens, I can't click on it. What am I doing wrong? $('<div>blabla<span id="remove">X</span></div>').insertAfter($("#add")); $('#remove').click(function(){ ...

Highlight Section of Mapped Image when Mouseover Text on Webpage

Scenario: Image with several areas mapped. A list of text on the page Desired functionality: When I mouseover the different pieces of text in the list, corresponding areas in the mapped image will become highlighted. Does anyone know of a good javascript tool that can do this? I have found a jquery plugin (map hilight) that will ...

jQuery UI Dialog adding unwanted inline styles to images

I am using JQUery UI to for the front end of a rails app I am developing. I am using jQuery dialog windows for displaying some tabbed data and inside one of these tabs I want to render some images. The rendering of the images works fine if I view the page without Javascript, however for some reason when putting it all in a dialog windo...

Jquery - Implement extension to table sort

Ok..so some kind fellow helped me with how to identify the first 4 rows and then apply css to them alone.. $("table").each(function() { $("tr:gt(4)", this).addClass("hidden"); }); $("table").tablesorter(); (http://www.tablesorter.com) now i need to modify the tablesorter that comes with an extension so that when ever the sort is p...

JQuery: Given a Parent Element, Testing for Certain Child Elements

NOTE: QUESTION HAS BEEN EDITED FROM ORIGINAL FOR CLARITY Hi all, I have the following code: <table id="myTable"> <th>Date</th> <th>Action</th> </table> and var $table = $('#myTable'); There is a condition in my JS where I will be appending table rows (<tr>) to this table, but I want to write a function to check to see if ...