I have the following:
HTML
<div class="tab-pane" id="message">
<textarea rows="4" cols="50" id="send_message" placeholder="Enter text ..."> </textarea>
<a href="#message" class="btn btn-large btn-info" data-toggle="tab">OK</a>
<a href="#message" class="btn btn-large btn-info" data-toggle="tab">Cancel</a>
JavaScript
$('#message').click(function(){
if($("a", this).is(":contains(OK)")) {
console.log("im in OK!!");
} else if($("a", this).is(":contains(Cancel)")) {
console.log("im in cancel!!");
}
});
This works fine when I hit the OK button and executes as expected, however when I hit cancel the code in OK is executed only. The cancel code never executes! What am I doing wrong?
a:contains('OK')still exists in a#message?