1

I'm using JQuery tabs. On click, I'm trying to just display an alert message (and make some coloring changes). Neither of which works -- I'm not sure why as when I move it out of the tabs part into regular html it works perfectly. Here's the relevant code:

In the addTab() from Jquery Tabs:

 tabContentHtml = "<div class=\"favorite\" status=\"off\">&#9734</div>" 

My own javascript code:

 $(".favorite").click( function(){ alert("in here"); var current_status = $(this).attr("status"); if(current_status == "off"){ $(this).html("&#9733;"); $(this).css({"color":"gold"}); $(this).attr("status", "on"); }else if (current_status == "on"){ $(this).html("&#9734;"); $(this).css({"color":"#EFEFEF"}); $(this).attr("status", "off"); } } ); 

Note that I do see the star in the tab, it's just not responsive!

1
  • start with step by step first simple alert after taht alert teh var after that other and also check you included jquery.js file Commented Feb 6, 2014 at 5:19

1 Answer 1

2

There is no click method for jQuery UI Tabs. Instead it is called as activate method,

$(function () { $("#tabs").tabs({ activate: function (event, ui) { alert("I'm triggered"); //Within this you can wtite ToDos } }); }); 

JSFiddle

Sign up to request clarification or add additional context in comments.

1 Comment

@user1357015 I'm glad I was able to help :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.