How to Change HTML Tags Using Javascript

Tags: javascript,html,css,tags,edit

Problem :

I have some HTML code that looks like this:

<textarea name="message"></textarea>

And I would like to change it to this:

<textarea maxlength="300" name="message"></textarea>

How can I accomplish this using Javascript? I have tried a lot of different code from a lot of different places, but none of them seem to work. If need be, I will accept CSS code too.

Solution :

$('textarea').attr('maxlength', 300);

    CSS Howto..

    How to make the opposite effect of Hover in css [duplicate]

    How to keep a very tight control over the order of CSS files in Yii Framework

    JavaScript: how do I make a tooltip follow the cursor *and* flip on collision?

    How to apply css to only one level of list items (not to child elements)

    How to convert shorthand CSS to longhand?

    CSS help, how to target this link inside of div

    how to change a css class style through javascript?

    How to override html property created by script (mediaelement.js)

    How to override priority in CSS classes?

    How can I retrieve infos from PHP DOMElement?

    How I can set a different font size for my text by css?

    how to set footer at bottom?

    how to make css sub menu links longer than parent link

    How to add strped tabs on Ionic css

    How to create overlaying papers (pile) - CSS / HTML

    How to change css for an element but keep defaults for it's children

    How to avoid using JavaScript with CSS attribute selector

    How center an absolute element (img) that's wider than its parent div?

    How to recalculate css vw and vh values after resizing?

    How to wrap UL list - LIs on new line with css

    How to ensure that the css border goes inside the image

    How to remove the blank between div.sons?

    How to format HTML/CSS to align with single word in sentence?

    How can I workaround this CSS anomaly?

    Angular show / hide with animation

    How am I supposed to change the Bootstrap CSS properties in a new Yeoman project?

    How to align image with text in a table ? (jquery datatable sort image with text in table header)

    how to align first li left and second li center in the ul element

    How to Make Text Black on .mouseover

    css: Image is on the border of parent's div. How to make text above that image in a div?