Hari Gillala
Hari Gillala

Reputation: 11916

Remove Style attribute on div tag

Can any one tell me, how do I remove style attribute from this below div?

<div class="ui-state-default ui-jqgrid-hdiv" style="width: 1085px;">

I have tried the below, but,it does not remove it.

$('.ui-state-default ui-jqgrid-hdiv').removeAttr('style')

Thank you

Upvotes: 1

Views: 3907

Answers (3)

Adil
Adil

Reputation: 148120

Use dot or comma to join the classes in selector

Live Demo

$('.ui-state-default.ui-jqgrid-hdiv').removeAttr('style')

Upvotes: 11

Faust
Faust

Reputation: 15404

The problem is with your selector.

$('.ui-state-default ui-jqgrid-hdiv').removeAttr('style')

needs to be

$('.ui-state-default.ui-jqgrid-hdiv').removeAttr('style')

Upvotes: 1

Robin Maben
Robin Maben

Reputation: 23054

Alternatively, this might be of help?..

var width = $(window).width(); //Just assuming screen width

$('#gridId').setGriWidth(width);

Upvotes: 1

Related Questions