guiskj
guiskj

Reputation: 47

How to hide jQuery Mobile Anchor Button

I would like to hide / show certain anchor buttons depending on conditions, but currently this is not working.

I have several jQuery Mobile anchor buttons that look something like this:

<a id="lteAlabamaButton" href="#" data-role="button" data-inline="true"   onclick="lteGaugeRefresh('Alabama')">Alabama</a>

<a id="lteArkansasButton" href="#" data-role="button" data-inline="true" onclick="lteGaugeRefresh('Arkansas')">Arkansas</a>

. . .

I tried $(buttonId).hide() but it does not work.
I also tried using.css('display','none') but that doesn't work either.

These anchor buttons are sitting in the content area of a jQuery mobile popup.

Upvotes: 0

Views: 499

Answers (1)

Ved
Ved

Reputation: 2701

HTML

<a id="lteAlabamaButton" href="" data-role="button" data-inline="true">Alabama</a>
<a id="lteArkansasButton" href="" data-role="button" data-inline="true">Arkansas</a>

JAVASCRIPT

$(document).ready(function(){

  $('[data-role="button"]').click(function() {
       var title = $(this).find('.ui-btn-text').html();
       $(this).hide();            
  });

})  

Upvotes: 1

Related Questions