Access/Change the html of a class in another webpart on the same page

I have a div class='myDiv' in a webpart on my page. I need to access that div from another webpart on the page I wish to use javascript/jquery to do so. Since they are not inside of the same page utility I cannot directly select it with jquery for example: $('.myDiv').hide(). How can I find this div in the other webpart from the webpart I am working in on the same page

Answers


It is better to give a ID for the div control and access else use below javascript to get that control.

var h = document.getElementsByTagName("input");
for (var i = 0; i < h.length; i++) {
    var j = h[i].id;
    if (j.indexOf('file') > 0) {
        alert(j);
    }
}

Need Your Help

Django 1.9 cannot connect to the MySQL server (blank screen)

python mysql django

I recently upgraded the MySQL version to 5.7.11 and Django to 1.9.2.

Eloquent relations and database constraints?

laravel eloquent laravel-migrations

since Eloquent supports relationships, would you recommend to additionally define foreign key constraints in the migrations?