GTS Joe
GTS Joe

Reputation: 4182

jQuery Change HTML Parameters on Page Load

When a page loads, how can I change a specific HTML element's parameters using jQuery? For example, in the following HTML, I would like to change type="submit" to type="button" and src="image1.jpg" to src="image2.jpg"

<form class="edit" action="" method="post">
    <input type="text" name="firstName">
    <input type="submit" value="Submit" class="thisOne">
</form>
<img src="image1.jpg">

Upvotes: 0

Views: 344

Answers (1)

Faiz Ahmed
Faiz Ahmed

Reputation: 1103

$(window).load(function() {
    $('input[name=firstName]').attr('type', 'button');
    $('img').attr('src', 'image2.jpg');
});

Just one example.

Upvotes: 1

Related Questions