I want to select the contents of a span in jquery. This is the html: <a href="?page=home&action=add&id={$film.film_id}"> <img src="images/shoppingcartButton.png" id="shoppingButton" alt="shoppingcartButton" title="shoppingcartButton"/> <span>{$film.film_id}</span></a>
The jquery I have is: lalala = ($('#shoppingButton span').text()); alert(lalala); But the result is empty.
I wrote the following script in order to traverse an HTML table and merge the cells that have the same value across multiple rows. For some reason, however, it works for the first, third, and fourth columns in my table, but in the second column, the merged cell is not aligned at the center vertically. The cells do get merged, but the cells in the second column are always aligned at the top. Trying cell.valign = "middle" had no effect.
Any thoughts? Could it be because I'm not actually deleting the cells that are to be merged with the top of each such block; instead I merely set style.display to none for these cells.
Here's my script:
var currCell; var totRows = T1.rows.length; var totColumns = T1.rows[1].cells.length; var numValues = T2.rows[0].cells.length-2;
var i,j; var nextRowMatch = true;
var myCell;
for (i=0; i<(totColumns-numValues); ++i) {
var currRow = 1; var j=currRow+1; var numCellsMerge = 1;
var identical = false;
while (j<totRows) { var currCell = T1.rows[currRow].cells[i].innerText; var nextCell = T1.rows[j].cells[i].innerText;
if (currCell != nextCell) {
if (i>0) {
var start=(i-1); var sameValues = 1;
while ((start >=0) && (sameValues == 1)) { var prevColText = T1.rows[currRow].cells[start].innerText; var prevColNextRowText = T1.rows[currRow+1].cells[start].innerText; if (prevColText != prevColNextRowText) {
sameValues = 0; } else { start = start-1; }
} if (sameValues == 0) { numCellsMerge = 1; }
}
if (numCellsMerge 1) { for (var k=currRow+1; k<j; ++k) { T1.rows[k].cells[i].style.display = 'none' } myCell = T1.rows[currRow].cells[i]; myCell.rowSpan = numCellsMerge;
I've got this JavaScript code that is doing stuff to the content of <TR> rows.. but it's overselecting and I need to filter the <TR>s it selects in the bold line.
var theRows = document.getElementsByTagName("TR"); var r = 0; var strTitle = "";
Just playing about really, am trying to add the selected table row values to text area. Tried using childNodes but I guess it doesn't work for table rows (just comes out as '[object] - undefined'). Any better methods? - I don't really want an overly complicated solution, afterall it's just testing to get me back into JavaScript again!
I have a need to select all table rows in the outer table of a cascading table structure, that is a table with contained tables. I tried to use the "Context" section of jQuery, but the table rows of the sub tables are being selected as well.
I'm using drupal, and am having trouble to convert a table to a one field two column at code level.Is it possible to manipulate it using jquery using odd and even?
I have some JQuery that makes an Ajax call and then adds some rows to an existing table.
function LoadDestinationTable() { $("#destinationTable tr:gt(0)"[code]...
The problem is that the only place where the click event fires is on the rows that were added when the page was 1st rendered – the th, for example.I also tried adding an onclick event handler to the input button’s creation – that also does not fire.
i'm creating a ASP page, which is going to have a form in it that needs filling out. part of the form will be a table with a header row, then the next rows will have text boxes that need filling out. is there a way of putting in a dropdown box that contatins numbers that will dynamically show the rows. for example if i select 5, then five rows of text boxes will appear. if i select 14 then 14 appear.
I have a HTML table with 800 rows. How can I delete rows that has no Activity & no $ in JavaScript(Red Colored Rows)? Please note I can have 1 or more than 1 assessments with 1 or more than 1 activity. Sample data.
I have a table that sorts in jquery and I have one column that I would like to always remain the same while the other columns sort around it. What I want is for the order of the column to always be Great, Bad, Failure while every other column can be sorted. What is the easiert way for me to do this?
I'm trying to make a php/jquery-based puzzle game where I have a standard html table (#puzzlegrid) generated by php, and I want to highlight certain parts of it when the mouse is hovering over it. I have one table where there are four different parts (split in the middle vertically and horizontally), separated by id's. The left and topmost cells has id="empty", all the rows beneath these has id="row-clues", the columns next to "empty" has id="column-clues" and finally the bottom-right cells has id="playing-grid", which the hover-function belong to. The number of #column-clues and #column-rows can vary, both in the count of rows and columns. I can give a example code if it's necessary.
As for the jquery-part, I simply want to highlight (add a css class) the current row and column when i hover over the #playing-grid cells. That means selecting all #column-clues and all #column-rows cells that exist on the same row/column the mouse is hovering over. This is what I have so far
$("#puzzlegrid td#playing-grid").hover(function() { var current_rowIndex = $(this).parent()[0].rowIndex; var current_columnIndex = $(this).parent().children().index($(this)); $("tr").eq(rowIndex).addClass("highlight");
[Code]....
I've tried a for-loop and each() without luck, as far as my jquery skills goes (and that's not far ). Is it possible to use the index for highlighting several columns, or do I have to do it another way? I can change the HTML code if that's necessary.
What I want to do is to create a function which shifts a table column one position to left. Therefore I'am trying to select all relevant td and th elements. My problem is to rearange the elements. Within the both each calls, see the code below, $(this).get(i) would result the td respectively the th element where the before function is undefined. But how to insert the elements correctly or is this the wrong way?
$.fn.shiftLeft = function(col) { // Make sure col has value if(!col){ col = 1; } var trsToMove = $('tr td:nth-child('+col+')',this);
I need a pointer to help me get this working on a dynamic table, it works fine on a static table I know its in the selector but i havent been able to figure it out [URL] $('#table').hideColumns(2);
I am trying to change the background color of a row based on a certain column value in SharePoint 2007. The code that i am using to achive this is given below. This code works fine. But i would like to filter the values rather than use :Contains.[code]
I have a table in which the first column is the row number (always from 1 at the top to 100 at the bottom) so no matter how the other columns are sorted that first column should be the 'rank' for that particular sort. Is it possible to do this with tablesorter? Could I change the values in the first column after tablesorter did it's work? I see how to disable sorting on the first column but that is not what I want.
I came across JQuery when searching for a solution to get matching column height with Divs. I have downloaded JQuery which appears to be one file named jquery-1.3.2.min I also have the following short script that I found, which I believe goes in the head area of the page.
The script works with jquery.
HOW TO DO:
1. I assume I need to rename my download file jquery-1.3.2.min to jquery.js ?
2. Do I need to edit the jquery file somehow in order to get the above script to work?
I have three columns from the css on my webpage, I have some text that is overflow:hidden in the first column and two empty columns next to it. My question is how could I use jQuery to make the text overflow onto the next columns rather than hidden in the first column.