By James

2018-03-13 15:56:06 8 Comments

I have a code where i need to create a href link to the images too. with the following screenshot

i tried it something like this:

$(document).ready(function() {
   var link = $(".car-image").find('li:first').find('a').attr('href');
   var appendtoimg = $('.car-image').closest('.img-responsive') - here i am stuck as i need to add an onclick event so it can work same as like <a> tag


@Dan Raps 2018-03-13 16:00:15

If you're using jquery you can add a click event listener.

$(".car-image").click(function(){ });

Related Questions

Sponsored Content

35 Answered Questions

[SOLVED] Is there an "exists" function for jQuery?

  • 2008-08-27 19:49:41
  • Jake McGraw
  • 644682 View
  • 2207 Score
  • 35 Answer
  • Tags:   javascript jquery

56 Answered Questions

[SOLVED] How to check whether a checkbox is checked in jQuery?

52 Answered Questions

[SOLVED] How do I check if an element is hidden in jQuery?

15 Answered Questions

[SOLVED] How can I refresh a page with jQuery?

51 Answered Questions

11 Answered Questions

[SOLVED] Disable/enable an input with jQuery?

38 Answered Questions

[SOLVED] Setting "checked" for a checkbox with jQuery?

24 Answered Questions

[SOLVED] jQuery scroll to element

  • 2011-07-13 09:49:44
  • DiegoP.
  • 1843836 View
  • 1755 Score
  • 24 Answer
  • Tags:   javascript jquery

31 Answered Questions

[SOLVED] Add table row in jQuery

15 Answered Questions

[SOLVED] "Thinking in AngularJS" if I have a jQuery background?

Sponsored Content