1

i am trying to add Element to existing html content using prototype insert. below is the html on which i am working

<table id="productGrid_table" class="data" cellspacing="0">
<thead>
    <tr class="filter">
        <th>
            <div class="range">
            </div>
        </th>
    </tr>
</thead>

here i want to add another < th> in < tr class="filter">, i am trying to achieve this using below prototype code

$('filter').insert("<th><div class='field-100'></div></th>");

please provide some suggestion what i am doing wrong here???

1 Answer 1

1

In PrototypeJS $('filter') selects element with id="filter". If you want to select by class, then use $$ function. Something like this:

$$('.filter')[0].insert("<th><div class='field-100'></div></th>");

But I'd recommend either changing class name to something more unique, or use id instead of class.

Sign up to request clarification or add additional context in comments.

1 Comment

In this instance you can make it more unique by using the id from the table as well $$('#productGrid_table .filter')[0]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.