JQuery :: When A Link Is Clicked That It Will Only Change Elements That Are Within It's Parent Div And Not The Others?
May 27, 2010
I have several divs that each have a certain link. How can I make sure that when a link is clicked that it will only change elements that are within it's parent div and not the others?
I want the <a/> in an <li/> to be triggered when the click happens anywhere within the </li>. So given the html...
<ul> <li><a href="javascript:alert('clicked!')">test</a> <span>some other stuff</span></li> <li><a href="javascript:alert('clicked!')">test</a> <span>some other
I'm making a webpage for a little embedded device with a touch screen. I don't want the mouse pointer to be visible until the user clicks on a link in which case the mouse pointer should change to an hour glass until the new page is displayed (the device is rather slow so the user needs to get some feedback while waiting). code...
This properly hides the cursor after the first page is loaded but it doesn't display the hour glass when I click on the link. Any ideas what I'm doing wrong?
I am trying to change the color of a link after it has been clicked on WITHOUT using CSS.
When the link is clicked some javascript is called. I can do this in IE by adding this "this.style.color = 'black'". However this doesn't work in other browsers. Anyone know how I could get this to work in other browsers?
I read some other threads regarding how to toggle an image but I was having a hard time understanding. I have a bunch of images on my page, each links to a different lytebox presentation when you click on them. I'd like to have the clickable image change to another image to indicate to the user that they have viewed that presentation. I was hoping there was a way to switch to the new image permanently rather than just toggling back and forth between the two images if they click on the presentation more than once.
I have created a site http:[url].... and there is an image on the page which I want to change if a user clicks on a link. I am not sure if javascript is the best way to do this but thought i would give it a go. The image is currently set in the css so I think i will need to change this to use js?
I am working on a explorer like tree in a php script. I have the standard + - in a box pics. How to I have the + pic change to the - pic when clicked. Also, how do I get it to change back when another + pic is chosen?
I have a side menu that I have added an onclick statement to, which will change the css class for that item to "selected" so that I can apply styles for the selected link. Here is what I have:
HTML Code: <style type="text/css"> <!-- .selected {[code]....
How can I modify this so, after one selection is clicked, and you click something else, the class gets removed from the first clicked item, and is now applied to the newly clicked item? I only want the class applied to the currently clicked item, and removed when they click on another item.
I need a counter that will display beside a link, with the number of times the same link has been clicked. I do not have FTP access to the site, since it is based on a CMS.
Adjust the CSS margins of the BODY element with the first slider. The yellow P (paragraph) element resizes to fit its smaller containing block, as I would expect.
Then, adjust the CSS border or padding of the BODY element with the second and third sliders. The P element does not resize, though its origin changes. Instead, it overflows its containing block.
Finally, adjust the margins again. The P element snaps back into its containing block.
As you can see from the source, this is jQuery 1.6.4 and jQueryUI 1.8 pulled from googleapis.com.
Not really sure how the best way to start explaining this, but I have a small script set up that activates a second section to an accordion to display information. The idea is that a table cell will be clicked and then the second according will activate displaying information relating to the cell that was clicked in accordion part 1.
I have managed to get it to update coding in the var's by hand, now I want to be able to get certain bits of information from a nested div that is hidden in the table cell (I know, very messy - but it will all be made a little less messy in the future when I have got the process correct).
<li><a href="#">Jetta</a> <ul class="jetta"> <li class="engine"><a href="#">Engine</a></li> <li class="brakes"><a href="#">Brakes</a></li> <li class="transmission"><a href="#">Transmission</a></li> <li class="interior"><a href="#">Interior</a></li> <li class="running_gear"><a href="#">Running Gear</a></li> </ul></li></ul> I want to post the class of the parent ul and the clicked li to php when they are clicked say as "model" and "part". I'm sure its simple but i cant seem to quite grasp how to do it.
I have a single page which uses tabs to segment the content. Alongside the tabs themselves is a button for 'Help'. I'd like this button to open a different DIV depending upon the tab that is currently being used.For example, if I am on a tab for 'Ben', if I click the 'Help' button I want the 'helpBen' DIV to slideToggle.If I am on a tab for 'Paul', when I click the 'Help' button I want it to open the 'helpPaul' div.
Some extra needs:
1. switching to a different tab should close the currently open help div (e.g. helpBen or helpPaul)
2. There should only be one help div (e.g. helpBen or helpPaul) open at any one time.
I partly solved this with the following code but with erratic results and I'd like to know what I'm dong so wrong!Here is the HTML for the help button:
<a class="helpTrigger" href="#">Help</a>
The help DIV's are like this:
<div class="helpBen">help relevant to Ben section</div> <div class="helpPaul">help relevant to Paul section</div>
The CSS for .help is display: none; by default so none are shown from the outset.
And here is the jQuery $(".helpTrigger").click(function(){ if (location.hash == '#Ben') {[code].....
In the words of Dr Evil, "throw me a frikkin' bone here..."
I have a jquery menu from which i want to post certain information when a particular element is clicked to my php script which searches a db based on the variables input and presents the information back on the page.
So jquery drop down menu has 4 sections all with drop downs. I want to return results based on the section and then the drop down clicked
So clearly i can get this working fine using html and a form but i just want to use the information in the <li> elements instead..
Can i in jquery do this: upon clicking said element post the class attribute and txt as two things to my php scripts?
I have a javascript for a tree view but i need to change it according to the requirement. Lets start with example with the treeview as follow:
1 Door phone 1.1 Ready Kits 1.1.1 Audioset 1.1.2 Videoset
[Code]....
Now the thing is in the current treeview a single category is open at a time. like if 1.1.1 is open 1.1.2 will b closed and similarly if 1.1 is open...1.2 will b closed. But i want that when i click on 1(Door phone) ie Door phone...evry node should be opened instead of just one similary when i click on 2(CCTV), all its node should be opened.
I have navigational links on my page, but when someone clicks one, i would like an effect to occur, and then the browser to navigate to the link and it usually would.
I am looking for a way to add an id attribute to a div element I append to my document so that i can find the id later and delete it. So far, no luck with jquery .each loop trying to assign unique value and add incrementing value to each of them. In my code, they all seem to have the same id and when I click again it just appends the same value again to all of them.
//first I add a title to the list using append. function addTitle () { $('.myList-box').append('<div class="mylistitem"><div class="mylistitem-image"><img width="30" height="40" src="[URL]small.aspx?TitleID=' + titleid + '"/></div><div class="mylistitem-title">' + title + '</div><div class="mylistitem-options"><a href="javascript:removetitle();">Delete From List</a></div>'); } // then I need a click function, that indexes all the current .mylistitem(s) and allows me to find the id I am clicking on so I can delete it! function removetitle() { $(".mylistitem").each(function(i) { this.id = this.id + "_" + i; }); var item = $(".mylistitem").attr("id"); alert(item); }