petko_stankoski
petko_stankoski

Reputation: 10713

Change attribute value of a tag

I have some tags like this:

<path d="M 782.5 421 C 787.828 421 787.828 429 782.5 429 C 777.172 429 777.172 421 782.5 421 Z"
fill="#4572A7" stroke="#FFFFFF" stroke-width="0.000001" width="8" height="8"></path>

And I want for all the tags to have bigger width and height instead of 8. But I'm confused because they aren't in the style attribute. How to change them via javascript or jquery?

Upvotes: 0

Views: 170

Answers (4)

klewis
klewis

Reputation: 8350

Try...

  $("path").attr("width","150");

Upvotes: 0

Jitender
Jitender

Reputation: 7971

Try this

    $(function (){

    $('path').attr({width:12, height:12})

})

Upvotes: 0

Safari
Safari

Reputation: 3382

you can just use the attr function of jquery like this.

$('path').attr('height','55');

the first parameter is the name of the attribute, the second one is the value.

Upvotes: 0

Matt Ball
Matt Ball

Reputation: 359776

$('path').attr({width: 16, height: 16})

http://api.jquery.com/attr

Upvotes: 6

Related Questions