-2

I'm attempting to add a placeholder attribute to multiple input tags with unique classes in a form. The form is generated by a plugin so I can't add the attribute in manually. Unfortunately nothing I have tried has worked. Because each placeholder is different I'm address each one separately...

Here's the HTML

<input class="name-field" type="text" id="yourName_38_1" name="yourName" value="">

The jQuery I'm using

$(".name-field").attr("placeholder", "name");

When I look in the console I get the following which is referring to line the jQuery is on.

Uncaught TypeError: $ is not a function

My understanding of jQuery is very basic. Please help

Thank you in advance.

Dave

Dave Morgan
  • 21
  • 2
  • 6

2 Answers2

1

You need to load jquery plugin.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>

Please add this line above your <script></script> tag.

0

Add jquery:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
Ajay Makwana
  • 2,330
  • 1
  • 17
  • 32