lonerunner
lonerunner

Reputation: 1322

Add class to specific table php or jquery solution?

Im building wordpress theme based on bootstrap, and on default wordpress calendar widget, styling is not matched with bootstrap styling.

However it's very easy to match width of columns in calendar widget.

When widget is activated it's wrapped in

<table id="wp-calendar">

If i am somehow able to add class to that table with that specific id i would solve problem with styling.

So basically instead of

<table id="wp-calendar">

i need to have

<table id="wp-calendar" class="table table-responsive table-striped">

Is there solution to add class to that specific table with that id?

Some php function or jquery?

Upvotes: 0

Views: 270

Answers (5)

Kishan
Kishan

Reputation: 935

using jQuery,

$("#wp-calendar").addClass("table table-responsive table-striped");

Upvotes: 2

AlexP
AlexP

Reputation: 9857

You can obviously modify the raw HTML and hard code the class name

<table id="wp-calendar" class="table table-responsive table-striped">

Or You can use JQuery function addClass

$('#wp-calendar').addClass('table table-responsive table-striped');

Upvotes: 1

David Thomas
David Thomas

Reputation: 253496

Well, in jQuery the solution would look like:

$('#wp-calendar').addClass('table table-responsive table-striped');

References:

Upvotes: 1

The Alpha
The Alpha

Reputation: 146269

Using jQuery you may do it like:

// document ready
$(function(){
    $('#wp-calendar').addClass('table table-responsive table-striped');
});

Upvotes: 1

Deryck
Deryck

Reputation: 7668

$('#wp-calendar').addClass('table table-responsive table-striped');

Upvotes: 1

Related Questions