JavaScript How to get href value of anchor tag if it has image tag in it get href value of anchor tag in jquery,get href

i tried to get the image src with jquery here is the code below

jQuery("img").click(function() {
    var im = $(this).attr('src'); 
    alert(im);
    return false;
});

above working fine i can get the image src. likewise i try to get href value of anchor tag only if it has a image tag in it otherwise it shouldn't.Below is a example containing image tag in it.

<a target='_blank' href="some.something"><img src="image1.jpg"></a>

how to do this?what selector is better?any idea?

Answer:1

I am trying to move an image (its a picture of a map) inside its container so a specific part of the image(a city) is in the center of its container when a div is clicked. I have this working but the ...

I am trying to move an image (its a picture of a map) inside its container so a specific part of the image(a city) is in the center of its container when a div is clicked. I have this working but the ...

  1. jquery animate left position
  2. jquery animate left to right
  3. jquery animate left to right slide example
  4. jquery animate left not working
  5. jquery animate left percentage
  6. jquery animate left
  7. jquery animate left to right slide
  8. jquery animate left to right loop
  9. jquery animate left slide
  10. jquery animate left toggle
  11. jquery animate left doesn't work
  12. jquery animate left to right toggle
  13. jquery animate left to right continuous
  14. jquery animate left auto
  15. jquery animate left 100
  16. jquery animate left right up down
  17. jquery animate left margin
  18. jquery animate left to right infinite
  19. jquery animate left position change
  20. jquery animate left fadeout

With this code, my chart is resizing when I drag the window, but not when I press the maximize button on windows or the full screen button on mac. Is this just a chart.js problem? Here is my JS for ...

With this code, my chart is resizing when I drag the window, but not when I press the maximize button on windows or the full screen button on mac. Is this just a chart.js problem? Here is my JS for ...

Here's what I have in mind: Given an array of objects: [ { "name": "Kirk", "count": 1 }, { "name": "Spock", "count": 1 }, { "name": "Kirk",...

Here's what I have in mind: Given an array of objects: [ { "name": "Kirk", "count": 1 }, { "name": "Spock", "count": 1 }, { "name": "Kirk",...

  1. remove duplicate objects from array javascript
  2. remove duplicate objects from list java
  3. remove duplicate objects from list c#
  4. remove duplicate objects from array javascript es6
  5. remove duplicate objects from list java 8
  6. remove duplicate objects from array lodash
  7. remove duplicate objects from list python
  8. remove duplicate objects from array java
  9. remove duplicate objects in arraylist java
  10. remove duplicate objects from arraylist
  11. remove duplicate objects from array swift 4
  12. remove duplicate objects from arraylist in java 8
  13. remove duplicate objects from array javascript reduce
  14. remove duplicate objects from array typescript
  15. remove duplicate objects from array php
  16. remove duplicate objects from list
  17. remove duplicate objects from array react
  18. remove duplicate objects in array js
  19. remove duplicate objects from array jquery
  20. remove duplicate objects from array c#

Take a look at the code below: var pocket = { cash: 1000, showCash: function() { return this.cash; } }; var thomas = { name: "Thomas", work: ...

Take a look at the code below: var pocket = { cash: 1000, showCash: function() { return this.cash; } }; var thomas = { name: "Thomas", work: ...