I have a page that loops through a db and places stories inside divs. I need to hide the first and second instances of those divs. Hiding the first one isn't a problem using display="none". The problem I'm having is how do I find and hide the second instance?
I have a javascript object which dynamically generates a table adding, deleting and moving rows as the user clicks on buttons or links. Problem is when I generate a table row and add the javascript method call to my class, I have to put the object instance name variable of the class in order for it to be called from the onclick=function(). This is seriously limiting, but I'm stuck for a way round it. Heres a edited of the code so you get the idea....
Instantiating the object :-
var dtl = new DynamicTableList("table1", $ {myObject.allFieldsAsJavaScriptArray}, true, true, true);
My javascript class DynamicTableList, note the dtl javascript object instance variable being referred to in the addRow function. How can I avoid this???
if (showDelete) { var cell2 = document.createElement('TD'); var inp2 = document.createElement('IMG'); / ************************************************** ***********************************************/ inp2.onclick=function(){dtl.delRow(this);} // Have to specify dtc!!!!!!!! / ************************************************** ***********************************************/ inp2.title='Delete' inp2.alt='Delete' inp2.src='images/delete.gif' cell2.appendChild(inp2); row.appendChild(cell2); }
...
tbody.appendChild(row);
this.processRows(); };
this.moveRow = function(node, vector) { }; }
Obviously the code dtl.delRow(this); is being dynamically generated, but how do I replace the dtl instance name with something that'll work whatever the user of this class calls the instance of it!
I need to change the background-image (or possibly background-position) property of each new instance of a div with a particular class. I will have a set of images to choose from, or could create a sprite with all of the images.
I have a file that generates web galleries in Adobe Lightroom. They are generated depending on which files are selected and the metadata in those files.
Basically it is a series of pages of thumbnails called index.html index_1.html index_2.html etc.
Then a set of pages for each individual image.
An example can be seen here: [url](the page navigation links are not great, but I have addressed that, they're at the bottom >> )
Currently if a user clicks on a photo there is a 'return to thumbnails button at the top, but this always takes them to /index.html
So the user could be at a picture after browsing to /index_39.html and still get returned to /index
Is there any way I can use history.go to find the last instance of index.html Or index_x.html (where x is any number) and take them back to that instead?
I have a hover fuction that returns a jquery object when it finds an anchor. What would be the test statement to see if the next ul has a class of 'secondary'? Then if this is true I would display it.
How do I add a class to the <p> tag before each disabled element..this is not working for me. Basically if it finds a disabled checkbox within my accordion ui I want to strike-through the text..
// add line-through for disabled checkboxes $( ':disabled').prev().addClass("disabled"); html
Is it possible to create a function that will find a class name or id name and then assign that name as variable string?
For example, my body has a class name:
<body class="Sunday">
I need to have a function (using jquery or just regular javascript) that will determine that class name and then assign it to a variable named bodyClass, so that bodyClass="Sunday".
I'm working on something that I want a user to be able to override by including a specific class somewhere in the CSS definitions. If that class doesn't exist I want to add a default style. This seems like something that should have come up before but search isn't coming up with anything. Can someone point me in the right direction? Local styles/classes override global classes right?[code]...
I've been fiddling around with a bit of javascript in a chrome extension - something to alter the Google buzz webpage.I'm trying to find each individual post basically and have the following:
var entry =$('.X0POSb'); //This main block contains the bulk of Google buzz content console.log(entry); var items = entry.find('.G3.G2');
I have put this code together and it should build but it fails. So I opened it in Netbeans and it builds but it cannot find the main class. How to I fix this?
The second line is yellow in NetBeans and the third and fourth are red.
The .find() method does not seem to match on input fields by using a class. The ti This problem seems to be only visible on input fields. The following is a demonstration of the issue:
I'm trying to make this code run and keep getting the same error. "Could not find the main class: Initials. Program will exit." I'm using jcreator and java is up to date. I really not sure if I posted this in the correct area but
I am using an ASP.NET Repeater control to create N number of code patterns similar to that above. The server code leads the input controls based on DB values. I want to default the second table to be hidden if the checkbox is blank (not checked) and shown if it is checked. I also want to duplicate this behavior on the click of the checkbox.
I've made a function for getting a ID for each sibling in a tree. Lets look at this DOM: <ul> <li>Five</li> //sibling ID 1 <li>Six</li> //sibling ID 2 <li>Seven</li>//sibling ID 3 </ul>
Here is the function: function getSiblingId(elm) { return $(elm).siblings().size() -$(elm).nextAll().size() + 1; }
And here is how I use it: var id = getSiblingId($('ul li:first-child')); // id = 1 Is there a more elegant way to get the same result? The work done in the getSiblingId-function has a lot of overehead.
I have an unordered list element which has click events registered. What i want is to be able to find the nth relative sibling to the list item that is clicked. In prototype I can simply say $(elm).next(3) or $(elm).previous(3) for the 3rd sibling forwards or backwards from the current sibling.
In JQuery there doesn't seem to be a way of getting a sibling relative to the current one, other than the immediate next() or prev(). So if I want the third previous I have to do this inJQuery
I made a table with some customer information. It holds an id (hidden for the users), a company name, a phone number, an e-mail address and so on.
Inside every table row, I've made a "delete" button that should delete the relevant row in that table (see "<td class="delete">"). What I would like to do is getting the customer id that is hidden inside the first (hidden) <td> of the table row you wish to delete. I'm quite new to jQuery and I realy can't find a sollution for it. Here's my HTML [code]...
The alerts are working fine I guess. I've got something like "[object Object]" for the first alert and "object HTMLTableCellElement]" for the second alert. The other 2 testrules don't work. Firebug gave me the error message "$(this).parent().children("td")[4].text is not a function", but for now, I realy don't know what I'm doing (wrong) in those last 2 rules. Anyone who could help me out with this newbie problem about parent, child and/or sibling elements?
Trying to hide a table that's a sibling to the anchor to which theclick event is being called. It works, with any element but a tableas a sibling. My code/markup: