• 0

JQuery REMOVE CLASS's STARTING...


Question

Hi guys i'm prob going about this the wrong way but this is what i have so far

 

The HTML

<div class="example">
    						<input type="radio" value="border-0" name="Border" id="text1" checked="checked"/>
    						No Border
    					</div>
    					
    					<div class="border-1 example">
   						<input type="radio" value="border-1" name="Border" id="text2" />
   						Single Line
   					</div>
   					
					<div class="border-2 example">
   						<input type="radio" value="border-2" name="Border" id="text3" />	
   						Double Line
   					</div>
   					
   					<div class="border-3 example">
   						<input type="radio" value="border-3" name="Border" id="text4" />
   						3D Line
   					</div>
   					

              <div class="font-1 example">
                            <input type="radio" value="font-1" name="Font" id="text1" checked="checked"/>
                            Normal Font
                        </div>
                        
                        <div class="font-2 example">
                           <input type="radio" value="font-2" name="Font" id="text2" />
                           Font 2
                       </div>
                       
                    <div class="font-3 example">
                           <input type="radio" value="font-3" name="Font" id="text3" />
                           Font 3
                       </div>
                       
                       <div class="font-4 example">
                           <input type="radio" value="font-4" name="Font" id="text4" />
                        Font 4
                       </div>
<span id="regdisplay" class="">HELLO</span>

The JS

$(function() {
  $('[name=Border]').click(function() {   
  	var classy = $(this).val();      
   $('#regdisplay').removeClass();
    if($(this).is(':checked'))  {
        $('#regdisplay').addClass(classy);
   }
 });
});

$(function() {
  $('[name=Font]').click(function() {   
  	var fonty = $(this).val();      
    $('#regdisplay').removeClass();
    if($(this).is(':checked'))  {
        $('#regdisplay').addClass(fonty);
   }
 });
});

The problem i have is once you selected the border and it has been applied to #regdisplay you then select a font but it will removeClass for the border.

 

What i was thinking was removeClass(border-????) or removeClass(font-????) but not shore how or maybe i'm going about this all wrong.

 

so help please.

 

P.S. Please excuse the formatting.

Link to comment
https://www.neowin.net/forum/topic/1165723-jquery-remove-classs-starting/
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • YouTube app is no longer compatible with several iPhones by Taras Buria Google is rolling out a new update for the YouTube app on iOS, and it is bad news for those still using an old iPhone. Starting with version 20.22.1, the latest release in the App Store, YouTube for iPhone now requires iOS 16 and newer. Previously, the app required a device with iOS 15 and newer. The new hardware requirement makes several iPhones incompatible with the latest version of the YouTube app. Those include the iPhone 6S / 6S Plus, iPhone 7 / 7 Plus, and the original iPhone SE. The seventh-generation iPod touch is also no longer compatible. On the iPad side, the update kicks out the second-generation iPad Air and the fourth-generation iPad mini. Although old iPhones can no longer install YouTube version 20.22.1 and newer, old versions continue working just fine. However, going forward, users will not receive new features and improvements. Also, at some point in the future, the app will stop working altogether. Another workaround is to use the web version of the app, but that also provides a limited experience compared to the up-to-date client. Google is not the only service that kicks out old and now unsupported Apple devices. Recently, WhatsApp developers dropped iPhones that cannot run iOS 15.1 or newer. The news is clearly a bummer for those who are still using their old iPhones, which, to Apple's credit, have a solid lifespan (as long as you are happy with the battery life). However, it is also worth keeping in mind that the iPhone 6S series was released almost a decade ago. Having ten years of support is impressive, but it is clearly time to move on. Perhaps my friend with his day-one iPhone 7 Black can finally consider buying something less ancient.
    • Guys have already appeared saying that Windows 11 ruined their lives, stole their bank password, killed their dog, kidnapped their mother and that's why they will never install Windows 11 again.
    • I think they start to use AI in Robots but in very early stage. I think in less than 20 years we will see these movies in real life
    • Uhh... how do you think current robots work? And do I really have to tell you the obvious...? That movies aren't real.
  • Recent Achievements

    • Week One Done
      primussolicitors798 earned a badge
      Week One Done
    • First Post
      nothin earned a badge
      First Post
    • Enthusiast
      Epaminombas went up a rank
      Enthusiast
    • Posting Machine
      Fiza Ali earned a badge
      Posting Machine
    • One Year In
      WaynesWorld earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      188
    2. 2
      snowy owl
      134
    3. 3
      ATLien_0
      130
    4. 4
      Xenon
      119
    5. 5
      +FloatingFatMan
      97
  • Tell a friend

    Love Neowin? Tell a friend!